I have a random String with numbers in it (for an example "G8j3sEb34ab4dk5A") and I need to either tokenize it or be able to just be able to tell where the numbers on that string are.

StringTokenizer doesn't work (I think) because A12B should be A 12 B and not A 1 2 B.

Using String.indexOf() isn't probably the wisest way of doing this, right?

Recommended Answers

All 2 Replies

I think it's StreamTokenizer that can differentiate.

You can cycle with indexes then check 'is numeric etc' for every character

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.