Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objective-C: unichar vs. char

Tags:

I'm a little confused between a unichar and a char. Can I treat unichar's similar to char's?

For example, can I do this:

-(BOOL)isNewLine:(unichar)c {  if(c == '\n')   return YES; else   return NO;  } 
like image 661
LeeMobile Avatar asked Jul 07 '09 14:07

LeeMobile


1 Answers

Yes, unichar is internally unsigned short, so you can meaningfully compare it with a char (if the latter is ASCII, but that works fine for '\n').

like image 63
Alex Martelli Avatar answered Nov 03 '22 20:11

Alex Martelli