What's the best way to iterate NSString? Code like following:
int len = str.length;
for (int i = 0; i < len; ++i)
{
unichar c = [str characterAtIndex:i];
// do something with c
}
looks ugly for me. I'd prefer something like
// does not compile, unfortunately
for (unichar c in str)
{
// do something with c
}
Is there any way to write it more gracefully than my first code snippet?