基于iOS的APP“好妈妈”开发日志十五
解决提取字符串中数字的问题
/// 从字符串中提取数字
class func getIntFromString(str:String) -> String {
let scanner = Scanner(string: str)
scanner.scanUpToCharacters(from: CharacterSet.decimalDigits, into: nil)
var number :Int = 0
scanner.scanInt(&number)
print(number)
return String(number)
}//转自https://www.cnblogs.com/yajunLi/p/6700954.html
luhh