2015-07-10 51 views

回答

17

您可以用NSCharacterSet

var str = "75003 Paris, France" 

var stringWithoutDigit = (str.componentsSeparatedByCharactersInSet(NSCharacterSet.decimalDigitCharacterSet()) as NSArray).componentsJoinedByString("") 

println(stringWithoutDigit) 

輸出做到這一點:

Paris, France 

取出的參考來源:https://stackoverflow.com/a/1426819/3202193

+0

非常感謝!我搜遍了谷歌,我找不到答案。再次感謝你! –

+0

@KevinScience歡迎,但我已經在stackoverflow上搜索,發現在objective-c中的一個答案,試圖迅速做到,並給你:) –