+ 1
Java
What is split(â\\s+â) in java
4 Answers
+ 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