Java String - Looping Through String Characters

by Dan Bunker

 

Looping Through the Characters

 

There are two basic ways you can loop through each character of a String. You can use the charAt(int index) method or the toCharArray() method. Inside the loop you can then process or work with the character in some way.