Stringtokenizer with String delimiter does not work

Asked

Viewed 60 times

1

I have to wear one string tokenizer to share a string in Java. the code is like this:

StringTokenizer st1 = new StringTokenizer(palavra, "--");

But when I enter the following string:

1 - -- * d 2

The split recognizes the "-" as delimiter. soon returns me as first token "1". How to make it recognize only when it is "--" and not only "-"

  • Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful for you. You can also vote on any question or answer you find useful on the entire site (when you have 15 points).

1 answer

1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.