3

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...

Oliver
  • 23,072
  • 33
  • 138
  • 230

1 Answers1

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