How would you split an existing string where a chararacter occurs into an array of strings, and store that character in a char? For example, inputting 123a5 would return {123,5} in an array and 'a' in a char. I've confused myself with this. I will greatly appreciate any help.

Recommended Answers

All 3 Replies

String a = "abcd125xyz1mniop897";

String[] n = a.split("[a-zA-Z]+");

Now you have to form similar way regex for getting character array... String[] c...

This is a different quest

Step 1. read the string (for eg : myString)

Step2: get each character in the string by the method
myStinr.charAt();
upto to the length of the string.
Step 3: then check each character with its ASCII value

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.