0 votes
1 view
in Java by (2.6k points)
StringTokenizer? Convert the String to a char[] and iterate over that? Something else?

1 Answer

0 votes
by (35.8k points)

I apply a for loop to emphasize the string and use charAt() to arrange specific character to check it. Since the String is achieved with an array, the charAt() program is a regular time operation.

String s = "...stuff...";

for (int i = 0; i < s.length(); i++){

    char c = s.charAt(i);        

    //Process char


That's something I would do. It appears the most obvious to me.

As far as precision goes, I don't think that endures here. It is all based on your style.