String.split won't deal with the spaces at the first
String test="   Begin with spaces";    

for(String n:test.split("\\s"))
			     
System.out.println(n);

The output is:



Begin
with
space

But I want to delete all the space, but it creates null strings. I can't use trim at first. So what's the best solution to this problem?
String.split won't deal with the spaces at the first
===

String test="   Begin with spaces";    

for(String n:test.split("\\s"))
			     
System.out.println(n);

The output is:



Begin
with
space

But I want to delete all the space, but it creates null strings. I can't use trim at first. So what's the best solution to this problem?