最近Javaを学んだので、問題を解決する簡単な方法が必要です。
public static void main(String[] args) {
String test = "F: M1,“Khan lanh”,1; M2,”Trai cay dia”,3; M3,”Chuoi luoc”,1; M4,”Canh chua”,3";
String [] result= test.split("F:");
for (int i=1;i<result.length;i++){
String [] result1=result[i].split(";");
for (int j=0;j<result1[i].length();j++){
String [] result2= result1[j].split(",");
for(String s: result2){
System.out.println(s);
}
}
}
}
これは私が期待するものとはかけ離れています:
M1
“Khan lanh”
1
M2
”Trai cay dia”
3
M3
”Chuoi luoc”
1
M4
”Canh chua”
3