由於有參考網址,所以就不多做解釋了。
需求
得到Type後的數值與Account後的數值,
字串內容
Type=5,Account=352151022027333
程式碼
String TN[] = new String[2];
Type_Name = description;
String[] TypeName = Type_Name.split("[,=]+");
for(int i=0 ; i < TypeName.length ; i++){
Type = Integer.valueOf(TypeName[1]);
DeviceAccount = TypeName[3];
}
1 2 3 4 5 6 7 | private String[] { String[] StringName = splitString. ; for(int i=0 ; i < StringName.length ; i++){ System.out. ; } return StringName; } |
參考網址
http://www.inote.tw/java-split-string-to-array
沒有留言:
張貼留言