笔记勿喷
package object_oriented;
// isEmpty(); 判断这个容器是否为空
// charAt(int i); 或者是[i] 返回i处的字符
// length(); 返回此字符串的长度
// toCharArray() 转化字符数组
// substring(int beginIndex, int endIndex); 返回从begin开始到end-1结束的子串
// toUpperCase(); 将此字符串中的所有字母都换为大写
// toLowerCase() 将此字符串中的所有字母都换为小写
// compareTo(String anotherString) 按字典顺序比较两个字符串
// compareToIgnoreCase(String anotherString) 按字典顺序且不区分大小写比较两个字符串
// equals(String anotherString) 判断两个字符串是否相等,相等返回true否则返回false
// equalsIgnoreCase(String str) 不区分大小写判读是否相等。
// indexOf(int ch); 返回指定字符在此字符串中第一次出现的索引
// indexOf(int ch, int fromindex); 从指定索引开始搜索
// indexOf(String str); 返回子串在此字符串中第一次出现的索引
// indexOf(String str, int fromindex); 从指定索引开始搜索
// lastIndexOf(int ch); 返回指定字符在此字符串最后一次出现的索引
// lastIndexOf(int ch, int fromindex); 从指定索引开始搜索
// lastIndexOf(String str); 返回子串在此字符串最后一次出现的索引
// lastIndexOf(String str, int fromindex); 从指定索引开始搜索
// startsWith(String prefix); 检查是否以某一前缀开始
// split(String regex); 根据正则表达式拆分 分裂
// replace() 重复几遍
// replaceAll(String s1,String s2); 用s2替换目标字符串中出现的所有s1
// replaceFirst(String s1,String s2); 用s2替换目标字符串中出现的第一个s1
public class String_st {
public static void main(String[] args) {
String s;
s = "123456";
//String ss=new String(字符数组 / 字节数组)
for (int i = 0; i < s.length(); i++)
System.out.print(s.charAt(i) + " ");// 1 2 3 4 5 6
char[] s1;
s1 = s.toCharArray();
for (char i : s1)
System.out.print(i + " ");
}
}