好岸园IT技术学习网 hopean.com IT新闻 js网页特效 it技术 二次开发

查询NSString字符串中字符的位置及length

    NSString *tmpStr = [[NSString alloc] initWithString:@"abcdefg"];

    NSRange range;

    range = [tmpStr rangeOfString:@"a"];

    if (range.location != NSNotFound) {

        NSLog(@"found at location = %d, length = %d",range.location,range.length);

    }else{

        NSLog(@"Not Found");

    }


更多阅读请访问:http://www.hopean.com

posted @ 2012-11-26 11:30  hopeanCom  阅读(398)  评论(0编辑  收藏  举报