This content has been marked as final. Show 3 replies
Is it possible to set multiple delimeters?Yes. Every char in the delimiter String is a delimter, so you can have as many as you like. If you think about multi-char delimiters: no.
If i set a delimeter as " " (1 space) and the dataNo, each space will be a splitting point. (I think. It's been a while. It'd be easy to write test code, you know.)
file contained data separated by 2 or more spaces is
it the same?
This should all be covered by the docs, and any lingering doubts can be answered with a little bit of test code.
No, each space will be a splitting point. (I think. It'sNo, it's the other way 'round: two or more spaces will always be treated as a single delimiter by StringTokenizer. To get the same behavior from split() you have to add a plus sign:
been a while. It'd be easy to write test code, you know.)
String tokens = str.split(" +");