I import a phone-number from "Contacts" and save in NSString
.
this string contains white-space and I try to delete them using the method:
numero = numero.stringByReplacingOccurrencesOfString(" ", withString: "")
this method doesn't work.
func sostituisci( stringa: NSString! ) -> NSString
{
var numero: NSString = ""
NSLog(stringa)
numero = ((stringa as String).stringByReplacingOccurrencesOfString(" ", withString: "") as NSString)
NSLog(numero)
return numero
}
the output unchanged
log
2014-11-05 17:54:50.734 HappyRicarica[33438:3119446] (327)?124-3503
2014-11-05 17:54:50.737 HappyRicarica[33438:3119446] (327)?124-3503
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…