java.lang.String

java.lang.String


    char charAt(int index)
        返回index索引位的字符。
    int compareTo(String other)
        对比两个字符串,按照字典顺序,若字符串在other之前,返回一个负数;若字符串在other之后,返回一个负数;若相等,返回0。
    int indexOf(String str)
    int indexOf(String str,int fromIndex)
        返回与字符串str匹配的第一个字串的开始位置,这个位置从索引0或fromIndex开始计算,若不存在str,返回-1。
    int lastIndexOf(String str)
    int lastIndexOf(String str,int fromIndxe)
        返回与字符串str匹配的最后一个字串的开始位置,这个位置从索引0或fromIndex开始计算,若不存在str,返回-1。
    int length()
        返回字符串的长度。
    boolean endsWith(String suffix)
        若字符串以suffix结尾,返回true。
    boolean startsWith(String prefix)
        若字符串以prefix结尾,返回true。
    boolean equals(Object other)
        若字符串与other相等,返回true。
    boolean equalsIgnoreCase(String other)
        若字符串与other相等(忽略大小写),返回true。
    String replace(CharSequence oldString,CharSequence newString)
        用newString替换原始字符串中的oldString,可以用String或StringBuffer对象作为CharSequence参数。
    String substring(int beginIndex)
    String substring(int beginIndex,int endIndex)
        截取原始字符串中从beginIndex(包含)到末尾或endIndex(不包含)的所有字符。
    String trim()
        删除原始字符串头部和尾部的空格。
    String toLowerCase()
        将原始字符串中所有大写字母改成小写字母。
    String toUpperCase()
        将原始字符串中的所有小写字母改成大写字母。
   

原文地址:https://www.cnblogs.com/it-mh/p/10346273.html