Browse - Programming Tips - How can I iterate through a String?

Date: 2013nov7
Language: Java


Q.  How can I iterate through a String?

A.	Here is a simple and pretty fast way:

String s = "Hello World"; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); }
Some guy compared all the possible ways for speed: http://stackoverflow.com/questions/8894258/fastest-way-to-iterate-over-all-the-chars-in-a-string