public class FindMess {
/*public static void main(String[] args) {
// TODO Auto-generated method stub
String mess="书名:Java程序设计,出版时间:2011.10.01," +
"出版社:清华大学出版社,价格:29.8 元,页数:389页";
if()
}
*/
public static void main(String[] args) {
String str1="wanglong";
str1="刘德华咿呀一鸭悠";
System.out.println(str1);
// String string = null;
// @SuppressWarnings("null")
char At= str1.charAt(2);
System.out.println(At);
String str2="清华大学出版社";
str1=str1.concat(str2);
System.out.println(str1);
boolean b1=str1.contains(str2);
System.out.println(b1);
boolean b2=str1.endsWith(str2) ;
System.out.println(b2);
boolean b3=str1.startsWith(str2);
System.out.println(b3);
str1=str1.replace("一","二");
System.out.println(str1);
str1=str1.replace("清华", "北京");
System.out.println(str1);
str1=str1.replaceAll(str1, str2);
System.out.println(str1);
str1=str1.concat(str1+"三三三");
System.out.println(str1);
str1=str1.replace("三", "五");
System.out.println(str1);
//按照逗号进行切割
String str3="yang,yi,chen,shi,xiao,di";
String[] array=str3.split(",");
System.out.println(array);
for(String str : array) {
System.out.print(str+" ");
}
System.out.print("。"+"HHHHHHHH");
System.out.println("");
//截取:留头不留尾巴
str3=str3.substring(12);
// 返回从索引往后的字符串
System.out.println(str3);
str3=str3.substring(5,9);
System.out.println(str3);
//去空格
str3=str3.concat(str1+" "+"lili"+" "+"!");
System.out.println(str3);
str3=str3.trim();
String str4 = " a b c ";
String str5= "abc";
String str6= "abc";
str4 = str4.trim();
System.out.println(str4 == str5); // false
System.out.println(str5 == str6); // true
System.out.println(str4);
}
}