字符串截取指定位置

例如:

      NSString *string = @"abavavasdsvx,as.dsf/,.[abcdefghijklmn]dgdfg";

      NSRange start = [string rangeOfString:@"["];                      NSRange end = [string rangeOfString:@"]"];                      NSString *sub = [string substringWithRange:NSMakeRange(start.location, end.location-start.location+1)];

       NSLog(@"sub=%@",sub);

 

控制台就输出:[abcdefghijklmn]

posted @ 2014-11-24 13:08  銱ル╬鎯噹  阅读(260)  评论(0编辑  收藏  举报