- NSMutableString *string = [NSMutableString stringWithFormat:@"%@",@"123-456-789-000"];
- //查找“-”
- NSRange rg = [string rangeOfString:@"-"]; //找到指定的你要删除的“-”然后在下面进行删除/这个是删除指定的位置所以先进行查找/然后删除指定的东西/还可以进行删除指定位置上的东西/
- do {
- //删除“-”
- [string deleteCharactersInRange:rg];
- //更新rg
- rg = [string rangeOfString:@"-"];
- } while (rg.location != NSNotFound);
- NSLog(@"%@",string);
- return 0;
- }