开发者

Objective-C: Compare unicode char with quotation mark

开发者 https://www.devze.com 2023-01-06 05:07 出处:网络
if (myChar == \'\"\') if ([myChar compare:@\"\\\"\"]) if ([myChar isEqual:@\"\\\"\"]) if (myChar == @\"\\\"\")
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

精彩评论

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