zoukankan      html  css  js  c++  java
  • java.lang 类String

    转载:http://www.cnblogs.com/hellokitty1/p/4389807.html

    方法摘要
    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() 
              返回此字符串的长度。

       未完待续。。。。。

  • 相关阅读:
    2019春季助教学期总结
    第二次实验设计报告
    第十二周作业
    第十一周作业
    第十周作业
    第九周作业
    第八周作业
    万恶的第七周作业
    第六周作业
    堆积如山的第五周作业
  • 原文地址:https://www.cnblogs.com/alloevil/p/5939405.html
Copyright © 2011-2022 走看看