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