无极低码 :https://wheart.cn

int indexOf(int ch, int fromIndex) 、int indexOf(int ch) 、int indexOf(String str, int fromIndex) 、int indexOf(String str) 、int lastIndexOf(int ch, int fromIndex) 、int lastIndexOf(int ch) 、int lastIndexOf(String str, int fromIndex) 、int lastIndexOf(String str) 、Java charAt() 、Java compareTo() 、Java compareToIgnoreCase() 、Java concat() 、Java contentEquals() 、Java endsWith() 、Java equals() 、Java equalsIgnoreCase() 、Java getBytes() 、Java getChars() 、Java hashCode() 、Java int length() 、Java matches() 、Java regionMatches() 、Java replace() 、Java replaceAll() 、Java replaceFirst() 、Java split() 、Java startsWith() 、Java subSequence() 、Java substring() 、Java toCharArray() 、Java toLowerCase() 、Java toString() 、Java toUpperCase() 、Java trim() 、Java valueOf() 、static String copyValueOf(char[] data, int offset, int count) 、static String copyValueOf(char[] data) 、String intern()

  1. indexOf(int ch, int fromIndex):用途:从指定索引(fromIndex)开始查找字符ch在字符串中首次出现的位置。返回值:返回字符在字符串中的索引位置;如果未找到,则返回-1。
  2. indexOf(int ch):同上,但不指定起始索引,默认从0开始查找。
  3. indexOf(String str, int fromIndex):用途:从指定索引(fromIndex)开始查找子字符串str在当前字符串中首次出现的位置。返回值:返回子字符串在当前字符串中的起始索引;若未找到,则返回-1。
  4. indexOf(String str):同上,但不指定起始索引,默认从0开始查找。
  5. lastIndexOf(int ch, int fromIndex):用途:从指定索引(fromIndex)向前查找字符ch在字符串中最后一次出现的位置。返回值:返回字符在字符串中的索引位置;如果未找到,则返回-1。
  6. lastIndexOf(int ch):同上,但不指定起始索引,默认从字符串末尾向前查找。
  7. lastIndexOf(String str, int fromIndex):用途:从指定索引(fromIndex)向前查找子字符串str在当前字符串中最后一次出现的位置。返回值:返回子字符串在当前字符串中的起始索引;若未找到,则返回-1。
  8. lastIndexOf(String str):同上,但不指定起始索引,默认从字符串末尾向前查找。
  9. charAt(int index):用途:获取指定索引位置的字符。返回值:返回位于指定索引处的字符。
  10. compareTo(String anotherString):用途:根据字典顺序比较两个字符串。返回值:如果当前字符串在字典序上小于另一个字符串,则返回负数;相等则返回0;大于则返回正数。
  11. compareToIgnoreCase(String str):用途:与compareTo类似,但忽略大小写进行比较。
  12. concat(String str):用途:将当前字符串与给定字符串连接成一个新的字符串。
  13. contentEquals(CharSequence cs):用途:检查当前字符串是否与指定CharSequence对象的内容相同。
  14. endsWith(String suffix):用途:判断当前字符串是否以指定后缀结尾。
  15. equals(Object anObject):用途:比较当前字符串是否与指定对象相等(对象必须为字符串类型)。
  16. equalsIgnoreCase(String anotherString):用途:与equals类似,但忽略大小写进行比较。
  17. getBytes():用途:将当前字符串转换为字节数组,使用平台默认的字符集编码。
  18. getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin):用途:将当前字符串的一部分复制到一个字符数组中。
  19. hashCode():用途:返回当前字符串的哈希码,通常用于散列结构如HashSet或HashMap中。
  20. int length():用途:返回当前字符串的长度(字符数)。
  21. matches(String regex):用途:使用正则表达式测试当前字符串是否匹配。
  22. regionMatches(boolean ignoreCase, int toffset, String other, int ooffset, int len):用途:比较当前字符串的一个区域与另一个字符串区域是否相等,可选择是否忽略大小写。
  23. replace(char oldChar, char newChar):用途:在当前字符串中用新字符替换旧字符,并返回新的字符串。
  24. replaceAll(String regex, String replacement):用途:使用正则表达式查找并替换所有匹配的部分。
  25. replaceFirst(String regex, String replacement):用途:使用正则表达式查找并替换第一个匹配的部分。
  26. split(String regex):用途:按照给定正则表达式分割当前字符串,返回一个包含子串的数组。
  27. startsWith(String prefix):用途:判断当前字符串是否以指定前缀开头。
  28. subSequence(int beginIndex, int endIndex):用途:返回一个从beginIndex到endIndex(不包括endIndex)的新字符串,即当前字符串的子序列。
  29. substring(int beginIndex, int endIndex):用途:返回一个从beginIndex到endIndex(不包括endIndex)的新字符串,即当前字符串的子串。
  30. toCharArray():用途:将当前字符串转换为字符数组。
  31. toLowerCase():用途:将当前字符串转为小写形式,并返回新的字符串。
  32. toString():在String类中,此方法隐式存在,它直接返回当前字符串对象本身,因为String对象本身就是字符串。
  33. toUpperCase():用途:将当前字符串转为大写形式,并返回新的字符串。
  34. trim():用途:移除当前字符串两端的空白字符,并返回修剪后的字符串。
  35. valueOf():用途:将基本数据类型转换为其对应的字符串表示形式。
  36. static String copyValueOf(char[] data, int offset, int count) 和 static String copyValueOf(char[] data):用途:创建一个新的字符串,其内容来自char数组的部分或全部元素。
  37. intern():用途:返回字符串常量池中该字符串的引用。如果常量池中已经存在相同的字符串,则返回该常量池中的实例,否则将当前字符串添加至常量池并返回该实例。
无极低码 :https://wheart.cn
最新文章