How to use NSScanner?

前端 未结 5 1587
走了就别回头了
走了就别回头了 2020-11-27 17:40

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

5条回答
  •  爱一瞬间的悲伤
    2020-11-27 18:15

    here is the reg-ex usage

    NSString *logString = @"user logged (3 attempts)";
    NSString * digits = [logString stringByMatching:@"([+\\-]?[0-9]+)" capture:1];
    

提交回复
热议问题