java - leading whitespace while using string.split() -


here's code using split string

str = "1234".split("") ;  system.out.println(str.length) ; //this gives 5 

there whitespace added before 1 i.e str[0]=" " how split string without having leading whitespace.

try this:

char[] str = "1234".tochararray(); system.out.println(str.length) ; 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -