美文网首页
iOS 去掉字符串中的特殊字符,并移除空格

iOS 去掉字符串中的特殊字符,并移除空格

作者: 可乐小子 | 来源:发表于2023-07-18 17:33 被阅读0次

NSCharacterSet doNotWant = [NSCharacterSet characterSetWithCharactersInString:@"@/:;()¥「」"、[]{}#%-+=\|~<>€^•'@#%^&*()+'""];
NSString * tempString = [[self.wordTextView.text componentsSeparatedByCharactersInSet: doNotWant]componentsJoinedByString: @""];

        NSString *returnString = [tempString stringByReplacingOccurrencesOfString:@" " withString:@""];
        
        [self.delegate FinishEditWith:returnString andIndex:self.index];

相关文章

网友评论

      本文标题:iOS 去掉字符串中的特殊字符,并移除空格

      本文链接:https://www.haomeiwen.com/subject/mtonudtx.html