Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
if? を使用してステートメント内の文字列を検索することは可能NSScannerですか?
if
NSScanner
ページの html を検索して、特定のコードがある場合は何かを実行し、そうでない場合は別のことを実行したいと考えていました...
ありがとう!
を使用する必要はありませんNSScanner。html 内の部分文字列を として検索するだけNSStringです。そのようです:
NSString
NSString *html = [webView stringByEvaluatingJavaScriptFromString: @"document.body.innerHTML"]; if ([html rangeOfString:@"some code here"].location!=NSNotFound) { //it exists in the web view }