String trim () :去掉字符串两端的空格
String [] split (String str):按照指定符号分割字符串
Code:
String s1 = "helloworld";
String s2 = " helloworld ";
System.out.println(s1.trim()); //helloworld
System.out.println(s2.trim()); //helloworld
String s4 = "aa,bb,cc,dd";
String [] strarray = s4.split(","); //根据,分割字符串
for (int x=0;x<strarray.length;x++) { //遍历数组
System.out.println(strarray[x]);
}