Replace character in NSMutableAttributedString
问题 This works for a regular NSString : NSString *newString = [myString stringByReplacingOccurrencesOfString:@"," withString:@""]; But there is no such method for NSMutableAttributedString . How could I remove all instances of a comma in an NSMutableAttributedString ? 回答1: let attrString = NSMutableAttributedString(string: "Hello <b>friend<b>") attrString.mutableString.replaceOccurrencesOfString("<b>", withString: "", options: NSStringCompareOptions.CaseInsensitiveSearch, range: NSRange(location: