// 按空格拆分 String str="java cpp php c# objective-c"; String[] strArr= str.split("\\s"); System.out.println(Arrays.toString(strArr));//[java, cpp, php, c#, objective-c] // 按+、-、=符号拆分String line="100+200-150=150"; strArr= line.split("[\\+\\-=]"); System.ou...
packagecom.swift;classArrayString {publicstaticvoidmain(String[] args) { String str= "swift:30|sunny:28|Ben:32"; String str1[]= str.split("\\|");for(inti = 0; i <= str1.length - 1; i++) { String str2[]= str1[i].split("\\:"); System.out.println("名字是" + str2[0...
// 按空格拆分 String str="java cpp php c# objective-c"; String[] strArr= str.split("\\s"); System.out.println(Arrays.toString(strArr));//[java, cpp, php, c#, objective-c] // 按+、-、=符号拆分String line="100+200-150=150"; strArr= line.split("[\\+\\-=]"); System.ou...