草庐IT

businessWebsite

全部标签

ios - 如何查看 NSString 是否以某个其他字符串开头?

我正在尝试检查我将用作URL的字符串是否以http开头。我现在尝试检查的方式似乎不起作用。这是我的代码:NSMutableString*temp=[[NSMutableStringalloc]initWithString:@"http://"];if([businessWebsiterangeOfString:@"http"].location==NSNotFound){NSString*temp2=[[NSStringalloc]init];temp2=businessWebsite;[tempappendString:temp2];businessWebsite=temp2;NSL

ios - 如何查看 NSString 是否以某个其他字符串开头?

我正在尝试检查我将用作URL的字符串是否以http开头。我现在尝试检查的方式似乎不起作用。这是我的代码:NSMutableString*temp=[[NSMutableStringalloc]initWithString:@"http://"];if([businessWebsiterangeOfString:@"http"].location==NSNotFound){NSString*temp2=[[NSStringalloc]init];temp2=businessWebsite;[tempappendString:temp2];businessWebsite=temp2;NSL