摘要:
NSString * str=[[NSStringalloc]init]; str=@"1234567890"; NSRange r; r=[str rangeOfString:textview.text]; if (r.location!=NSNotFound) { NSLog(@"found at location = %d,length = %d",r.location,r.length); } else { NSLog(@"not found"); } 阅读全文
摘要:
//获取文件路径 NSString *path = [[NSBundlemainBundle] pathForResource:@"user.plist"ofType:@""]; //获取数据 NSMutableDictionary* dict = [ [ NSMutableDictionaryalloc ] initWithContentsOfFile:path ]; NSString* object = [ dict objectForKey:@"aaa" ]; NSLog(object); //修改数据 NSMutableDic 阅读全文
摘要:
//判断文件是否存在 if(![c judgeFileExist:@"user.plist"]) { NSLog(@"请确认该文件是否存在!"); return; }//判断文件是否存在-(BOOL)judgeFileExist:(NSString * )fileName{ //获取文件路径 NSString *path = [[NSBundle mainBundle] pathForResource:fileName ofType:@""]; if(path==NULL) return NO; returnYES;} 阅读全文