Searching within NSString

前端 未结 2 1378
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-16 10:52

I have an NSString that is of the following pattern:

Hello


No.: 123456789123
Age: 21

Country: xxx

How can I search within said string so

2条回答
  •  情深已故
    2021-01-16 11:21

    I think [yourString substringWithRange:[yourString rangeOfString:@"123456789123"]] should give you what you want.

    Presumably you have a variable with the value "123456789123", in which case you would do [yourString substringWithRange:[yourString rangeOfString:otherString]].

    For more information, see the NSString class reference.

提交回复
热议问题