I\'ve just read Apple\'s docu of NSScanner. I\'m trying to get the integer of that string: @\"user logged (3 attempts)\".
I can\'t find any example, how to scan with
NSScanner
is a linear scanner. You have to scan through the stuff you don't want to get to what you do want.
You could do [aScanner scanUpToCharactersInSet:[NSCharacterSet decimalDigitCharacterSet] intoString:NULL]
to jump past everything up to the number character. Then you do [aScanner scanInteger:&anInteger]
to scan the character into an integer.