I am using this code:
StringTokenizer tokenizer=new StringTokenizer(line, "::");
to split the following String:
hi my name is visghal:: what is yor name name:: being thw simple my::: what is yor name name.
Now i want to split the string using :: as delimiter. It is working fine. But it is also taking ::: into consideration.
In other words i want:
hi my name is visghal
what is yor name name
being thw simple my
: what is yor name name
Instead it is giving me the following:
being thw simple my
what is yor name name
hi my name is visghal
It is taking :: and ::: as same. Is there any means to avoid this?
You can just use String#split like this:
EDIT:
OUTPUT: