开发者

Objective-C: Compare unicode char with quotation mark

if (myChar == '"') 
if ([myChar compare:@"\""]) 
if ([myChar isEqual:@"\""]) 
if (myChar == @"\"")

None of the comparisons above seem to work. I need to check if myChar, which is taken from an NSString, is a qu开发者_如何学Cotation mark.

Any ideas?


The first one works, actually, if myChar is actually a char. The question is a bit unclear: are you trying to compare to a quote ('"') or a question mark ('?') ?

But yea, the first one works.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜