2015-07-10 27 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中的一个答案,试图迅速做到,并给你:) –