public class StringDemoA {
public static void main(String args[]) {
//String str = "hello";
/*char c = str.charAt(0);//public char charAt(index)
System.out.println(c);//从字符串中找到指定索引字符*/
/*//public char[] toCharArray() 字符串转化成字符数组
char c[] = str.toCharArray();
for (int x = 0; x < c.length; x++) {
//加上c[x] -= 32;小写变大写System.out.print(new String(data));
System.out.print(c[x] + ",");
}
System.out.println();*/
/*//给定一个字符串判断他是否由纯数字组成
String str = "50353k8035";
if (isNumber(str)) {
System.out.println("字符串由纯数字组成");
} else {
System.out.println("字符串由非纯数字组成");
}
}
public static boolean isNumber(String str) {
char [] temp = str.toCharArray();
for (int x = 0; x < temp.length; x++) {
if (temp[x]<'0' || temp[x]>'9') {
return false;
}
}
return true;//如果全部验证通过
}*/
//public byte[] getBytes()将字符串转换为字节数组
//public boolean equals(String anObject)进行字符串相等判断区分大小写
//public boolean equalsIgnoreCase(String anObject)进行字符串相等判断不区分大小写
//public int compareTo(String anotherString)字符串大小比较=0 >0 <0
//public boolean contains(String s)判断指定内容是否存在
//public int indexOf(String str)从前到后返回字符串的位置
//public int indexOf(String str, int form)从指定位置前到后返回字符串的位置
//public int lastIndexOf(String str)从后到前返回字符串的位置
//public boolean startswith(String pre)判断是否以指定字符串开头
//public boolean endswith(String pre)判断是否以指定字符串结尾
//public String replaceAll(String a, String b)用b的内容替换a所有的内容
//public String replaceFirst(String a, String b)用b的内容替换a第一个的内容
//public String substring(int beginIndex)从指定索引截取到结尾
//public String substring(int beginIndex, int endIndex)截取部分字符串
/*//public String[] split(String regex)字符串拆分成若干个字符串数组
String str = "张三:1 | 李四:2 | 王五:3";
String result [] = str.split("\\|");
for (int x = 0; x < result.length; x++) {
String temp [] = result[x].split(":");
System.out.println("姓名 " + temp[0] + " 年龄 " + temp[1]);
}*/
//public String toLowerCase()转小写
//public String toUpperCase()转大写
//public String trim() 去掉字符串两边的空格
//public int length()
//public String intern()数据入池
//publin boolean isEmpty()
}
}