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
Post a Comment