1
我有這種行爲,我不明白。rangeOfString不識別子字符串
NSString *title = [[PushNotifcationManager getPushNotificationSettingsForKey:@"settings"] objectForKey:@"title"];
NSLog(@"title: %@",title); //Outputs Test\ntest
if([title rangeOfString:@"\n"].location == NSNotFound){
//String contains no \n
}else{
//String contains \n
}
即使字符串包含明確 「\ n」 的[title rangeOfString:@"\n"].location == NSNotFound
回報true
。任何人都可以幫助我呢?
它的工作,謝謝! – dan