I'd like to compare a character returned by characterAtIndex with some "hard" charaters, like @" ", or @"P". This may look stupid, but I don't find the way to do this...
Asked
Active
Viewed 4,985 times
1 Answers
10
Use single quotes:
if ([@"test" characterAtIndex:1] == 'e')

GendoIkari
- 11,734
- 6
- 62
- 104
-
@Oliver If you still need it **[yourString appendString:[NSString stringWithFormat:@"%c", character]];** will append the character to the end of the string. – Brenton Morse Mar 09 '11 at 21:08