特殊文字を含む文字列を作成した後、別の NSString を反復処理して、目的の NSString と新しいものとの間に一致が見つかるかどうかを確認しようとしています。ただし、 rangeOfString は特殊文字でハングアップしているようです。
本質的にはこれがアイデアであり、問題は NSLog が決して "Hurray!" を読み取らないことです。平方根記号が見つからないためです。
NSString *goal = @"√"
NSString *input =@"Messing with Sasquatch √"
int strLength = [input length];
int strpos = 0;
unichar ch = [input characterAtIndex:strpos];
while (strpos < strLength)
{
ch = [input characterAtIndex:strpos];
if ([goal rangeOfString:[NSString stringWithFormat:@"%c",ch]].location != NSNotFound)
NSLog(@"Hurray!");
++strpos;
}
ありがとう!