best way to loop over a string java code example
Example 1: iterate over string java
String str = "hello";
for (char c : str.toCharArray())
//process c
Example 2: java loop through string
String s = "...stuff...";
for (int i = 0; i < s.length(); i++){
char c = s.charAt(i);
//Process char
}