java.lang 类String

时间:2023-03-09 18:24:54
java.lang 类String
方法摘要
1  char
charAt(int index)

返回指定索引处的 char 值。
               index - char 值的索引。
2 string
       concat(String str) 
          将指定字符串连接到此字符串的结尾。
                 str - 连接到此 String 结尾的 String

substring(int beginIndex) 
          返回一个新的字符串,它是此字符串的一个子字符串。
            beginIndex - 起始索引(包括)。
3  boolean 
        endsWith(String suffix) 
          测试此字符串是否以指定的后缀结束。 
              suffix - 后缀。

startsWith(String prefix) 
          测试此字符串是否以指定的前缀开始。
 
       equals(Object anObject) 
          将此字符串与指定的对象比较。
         anObject - 与此 String 进行比较的对象

equalsIgnoreCase(String anotherString) 
          将此 String 与另一个 String 比较,不考虑大小写。
          anotherString - 与此 String 进行比较的 String

4 int
       indexOf(int ch) 
          返回指定字符在此字符串中第一次出现处的索引。
             ch - 一个字符

indexOf(int ch, int fromIndex) 
          返回在此字符串中第一次出现指定字符处的索引,从指定的索引开始搜索。
          ch - 一个字符   fromIndex - 开始搜索的索引。

indexOf(String str) 
          返回指定子字符串在此字符串中第一次出现处的索引。
         str-任意字符串

indexOf(String str, int fromIndex) 
          返回指定子字符串在此字符串中第一次出现处的索引,从指定的索引开始。
          str - 要搜索的子字符串。fromIndex - 开始搜索的索引位置。
     public int lastIndexOf(int ch) 
    public int lastIndexOf(iint ch, int fromIndex)  
    public int lastIndexOf(String str) 
    public int lastIndexOf(String str, int fromIndex)

length() 
          返回此字符串的长度。

未完待续。。。。。