Objective-C - 使用 NSScanner 读取字符串?
所以我正在尝试读取 html 字符串的内容。
[scanner scanUpToString:@"<" intoString:&result];
将内容读入字符串但忽略最后一个字符(在本例中为“<
”)的最快方法是什么。我不想执行 stringByReplacingOccuranceOfString
,这会执行缓慢
SO I am trying to read content of an html string.
[scanner scanUpToString:@"<" intoString:&result];
What is the fastest way to read the content into string but ignore the last character which in this case is "<
". I don't want to do stringByReplacingOccuranceOfString
, that would perform slow
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
NSScanner 的
-scanUpToString:(NSString *)stopString intoString:(NSString *)result
结果中不包含 stopString;您不需要忽略最后一个字符,因为它不包括在内。
NSScanner's
-scanUpToString:(NSString *)stopString intoString:(NSString *)result
does not include the stopString in the result; you don't need to ignore the last character, because it's not included.