zoukankan      html  css  js  c++  java
  • String的常用方法和作用

    1、
    char[] value ={'a','b','c','d'};
    String str = new String(value);//输出 abcd
    2、
    char[] value ={'a','b','c','d'};
    String str = new String(value, 1, 2);输出 bc

    3、

    //获取字符串的长度

     4、

      5、

      6、

      7、

       获取字符在str中第一次出现的地方

      8、

    String s = "helloworld";
    // 从beginIndex开始截取字符串到字符串结尾
    System.out.println(s.substring(0));//helloworld
    System.out.println(s.substring(5));//world

       和

    String s = "helloworld";
     // 从beginIndex到endIndex截取字符串。含beginIndex,不含endIndex。
    System.out.println(s.substring(0, s.length()));//helloworld
    System.out.println(s.substring(3,8));//lowor
  • 相关阅读:
    03-spring bean
    04-spring的依赖注入
    01-课程安排
    17-注解开发
    WIN10新机必要设置记录 for 3dsmax
    ps导出svg
    VS C# 共享项目
    在Maxscript中创建.Net类型
    C# 自定义索引
    C# ?
  • 原文地址:https://www.cnblogs.com/zhaohuihui/p/12160345.html
Copyright © 2011-2022 走看看