iOS 去除字符串中用括号括住的位置

直接上代码

-(NSString*)handleStringWithString:(NSString*)str{

NSMutableString* muStr = [NSMutableStringstringWithString:str];

while(1) {

NSRangerange = [muStrrangeOfString:@"("];

NSRangerange1 = [muStrrangeOfString:@")"];

if(range.location!=NSNotFound) {

NSIntegerloc = range.location;

NSIntegerlen = range1.location- range.location;

[muStrdeleteCharactersInRange:NSMakeRange(loc, len +1)];

}else{

break;

}

}

returnmuStr;

}

你可能感兴趣的:(iOS 去除字符串中用括号括住的位置)