NSString *myStrings = @"abcdefghijklmnopqrstuvwxyz";
How could I iterate each of the letters (a, b, c, d, e, etc..) in an Objective-C for
loop?
One way is to use a simple for-loop:
for (NSInteger charIdx=0; charIdx<myStrings.length; charIdx++)
// Do something with character at index charIdx, for example:
NSLog(@"%C", [myStrings characterAtIndex:charIdx]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With