i'm trying to remove white spaces and some characters from a string, please check my code below
// giving phoneString = +39 333 3333333 var phoneString = ABMultiValueCopyValueAtIndex(phone, indexPhone).takeRetainedValue() as! String // Remove spaces from string phoneString = phoneString.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceCharacterSet()) // Remove +39 if exist if phoneString.rangeOfString("+39") != nil{ phoneString = phoneString.stringByReplacingOccurrencesOfString("\0", withString: "+39", options: NSStringCompareOptions.LiteralSearch, range: nil) } print(phoneString) // output +39 333 3333333 it seems like all the changes has no effect over my string, why this happen?
EDIT @V S
EDIT 2:
I tried to convert my string in utf 8, check the result:
43 51 57 194 160 51 51 51 194 160 51 51 51 51 51 51 51 where:
43 = + 51 = 3 57 = 9 160 = space 194 = wtf?!? is this? 