Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
734 views
in Technique[技术] by (71.8m points)

iphone - Objective-C: unichar vs. char

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 == '
')
  return YES;
else
  return NO;

}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...