I having an issue using NSScanner.
I have this string: 195 058 042 yuiyui 123
and I'm trying to just return the integers. however, any number that contains a 0 before the space doesn't get scanned property.
var note = "195 048 042 yuiyui 123"
let whitespaceAndPunctuationSet = NSMutableCharacterSet.whitespaceAndNewlineCharacterSet()
let numbersCharacterSet = NSCharacterSet.decimalDigitCharacterSet()
let stringScanner = NSScanner(string: note)
var value = 0
while stringScanner.scanInteger(&value) {
print(value)
}
and this prints the following: 195 48 42
It it missing the 0 from '048' But I'm not sure why
it should print the following
195 048 42
Thanks