0
가능한 중복 :
Find next match of a phrase with NSScannerNSScanner 용 .txt 파일에서 문자열을 검색하려면 어떻게해야합니까?
내가 현재있는 UIWebView에서 코드의 특정 조각을 얻을 수있는 다음과 같은 코드를 가지고 : 나는를 스캔 할 수있는 방법
NSURL *requestTimetableURL = [NSURL URLWithString:@"http://www.dhsb.org/index.phtml?d=201435"];
NSLog(@"Loaded Timetable");
NSError *error;
NSString *page = [NSString stringWithContentsOfURL:requestTimetableURL
encoding:NSASCIIStringEncoding
error:&error];
[webView loadHTMLString:page baseURL:requestTimetableURL];
NSString* Period1;
NSScanner *htmlScanner = [NSScanner scannerWithString:page];
[htmlScanner scanUpToString:@"<P align=center><STRONG><FONT color=#c00000>" intoString:NULL];
[htmlScanner scanString:@"<P align=center><STRONG><FONT color=#c00000>" intoString:NULL];
[htmlScanner scanUpToString:@"</FONT>" intoString:&Period1];
합니다. txt 파일 (위의 문자열을 포함하고 있습니다) 코드?
E.G. [htmlScanner scanUpToString:teststring intoString:NULL];
(TestString에이 .txt 파일 인)
감사합니다!
이해가 안 : http://iphoneincubator.com/blog/data-management/how-to-read-a-file-from-your-application-bundle
당신은 DIR, 사용 번들 (앱)에서하지만 문서에서 읽을 수 없다 경우 질문, 당신은 아마 의미합니까 : NSString에 .txt 파일을로드하여 스캔 할 수 있습니까? – Jan
미안하지만, 아주 잘 말하지는 않았지만, 그 말이 내가 의미하는 바입니다 :-) – pixelbitlabs