A
au.danji
Hello all, I have a question about the String split method.
I have a string s1:
String s1 = "a \"single unit\" test";
String[] strArr = s1.split(" ");
the result is:
strArr[0]: a
strArr[1]: "single
strArr[2]: unit"
strArr[3]: test
but I want to let "single unit" to be in the same array element, just
like this:
strArr[0]: a
strArr[1]: "single unit"
strArr[2]: test
Can anybody tell me how to do that? should I use the regular
expression?
Thanks a lot!
I have a string s1:
String s1 = "a \"single unit\" test";
String[] strArr = s1.split(" ");
the result is:
strArr[0]: a
strArr[1]: "single
strArr[2]: unit"
strArr[3]: test
but I want to let "single unit" to be in the same array element, just
like this:
strArr[0]: a
strArr[1]: "single unit"
strArr[2]: test
Can anybody tell me how to do that? should I use the regular
expression?
Thanks a lot!