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