-3
變化的基礎上,一個字符串我已經宣佈其爲具有行數如何分割的線
String s = "Rahul Joseph" + "\n"
+"Jon Dam" + "\n"
+"Mike Ross" + "\n"
+"Stephen Harley" + "\n"
+"John Joe";
輸出將是一個字符串:我使用
Rahul Joseph
Jon Dam
Mike Ross
Stephen Harley
John Joe
代碼將其拆分成不同的字符串是:
String[] splitted = s.split("/n");
for(i=0;i<splitted.length;i++){
System.out.println(splitted[i]);
}
但它沒有分裂它。任何幫助將不勝感激
你的字符串是「\ n」,但你的分割是「/ n」 –
沒錯。就是這麼說的。 –