【发布时间】:2012-06-28 06:54:48
【问题描述】:
如何在NSString 中获取子字符串的位置/索引?
我正在通过以下方式找到位置。
NSRange range = [string rangeOfString:searchKeyword];
NSLog (@"match found at index:%u", range.location);
当searchKeyword 是string 中的子字符串时,这将返回index:2147483647。
我怎样才能得到像 20 或 5 这样的索引值?
【问题讨论】:
标签: iphone objective-c ios xcode ios4