+ 1
Java
What is split(“\\s+”) in java
4 odpowiedzi
+ 3
split("\\s"); using this it splits your string on the basis of whitespace in your string.
Simple code :
String s = "hi sololearn lol";
String[] spl= s.split("\\s");
For(String x : spl)
{
System.out.println(x);
}
Outputs:
Hi
Sololearn
Lol
+ 1
hi thank you but why we use two // instead of one ? to split more than one space?
0
ohh nice thank you