iphone 上的 NSScanner 简单问题
我的字符串是 k= /Users/applefan/Library/Application Support/iPhone Simulator/3.1.3/Applications/422B3239-F521-4985-89FE-EC778C57C0AB/Documents/1.sql
现在如何获取1 from 1.sql
我做了类似的事情,
NSScanner *scanner = [NSScanner scannerWithString:storePath];
[scanner scanUpToString:@".sql" intoString:&k] ;
NSLog(@"test is %@",k);
我也这样做了,
unsigned int intValue;
while([scanner isAtEnd] == NO) {
[scanner scanHexInt:&intValue];
NSLog(@"HEX : %d", intValue);
**}
它给了我所有的 int 值**,
但我只想要 /Documents/ 之后的数值
my string is k= /Users/applefan/Library/Application Support/iPhone Simulator/3.1.3/Applications/422B3239-F521-4985-89FE-EC778C57C0AB/Documents/1.sql
now how to get 1 from 1.sql
i did somethins like this
NSScanner *scanner = [NSScanner scannerWithString:storePath];
[scanner scanUpToString:@".sql" intoString:&k] ;
NSLog(@"test is %@",k);
i did this also
unsigned int intValue;
while([scanner isAtEnd] == NO) {
[scanner scanHexInt:&intValue];
NSLog(@"HEX : %d", intValue);
**}
it gives me all the int value**
but i only want the numeric value after /Documents/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)