我传入了以下样式字符串:
<p><iframe width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F79039882"></iframe></p>
和
<p><iframe width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F82229979&color=ff6600&auto_play=true&show_artwork=true"></iframe></p>
我需要从给定的字符串中过滤掉字符串“79039882”或“82229979”。
目前我正在使用以下代码:
NSString * temp1;
NSScanner *scanner = [NSScanner scannerWithString:label];
[scanner scanUpToString:@"%2Ftracks%2F" intoString:nil];
[scanner scanString:@"%2Ftracks%2F" intoString:nil];
[scanner scanUpToString:@"&" intoString:&temp1];
不幸的是,它在第一个格式化的字符串上失败了。我将如何解释这两种类型?
当在 temp1 中传递第一种字符串样式时,结果如下:
79039882"></iframe></p>