判断是否是 " "
System.out.println(s1.isEmpty());
length长度
equals 比较是否相等
判断谁大
compareTo
compareToIgnoreCase 忽略大小写
replace替换syso
System.out.println(s1.replace("a","f"));//fbcf.mp4
toUpperCase();大写
toLowerCase();小写
去除左右的空格
s1.trim();
split切割syso .split(,)
System.out.println(Arrays.toString(s2.split(",")));
substring()截取
System.out.println(s1.substring(2));//ca.mp4
System.out.println(s1.substring(2, 4));//ca
contains判断是否包含
System.out.println(s1.contains("ca"));
lastIndexOf 查找出现的位置
System.out.println(s1.lastIndexOf("a"));//3
indexOf 查找出现的位置
System.out.println(s1.indexOf("a"));//0
System.out.println(s1.indexOf("a",2));//3
System.out.println(s1.indexOf("x"));//-1
是否是视频格式 endsWith
System.out.println(s1.endsWith(".mp4"));
取字符串的第一个
System.out.println(s1.charAt(0));//'a'
判断该字符中存在多少个f
String temp = "weursfasdfhasfjweorigdshg" + "dafhsafjsafjafoewruwrqruqw9" + "rhfidsfhasfdcjzvbvsafnakwef"
+ "afkhasfhafeiawruwahfasfhads" + "fasfasfasfasfwerwqarhfafafa";
替换f为""
String newTemp = temp.replace("f", "");
System.out.println(temp.length()-newTemp.length());