find range of substring of string

前端 未结 3 1248
清酒与你
清酒与你 2020-12-29 05:37

I am trying to figure out how to get a range of a substring within a string. By range I mean where the substring begins and where it ends. So if I have following string exam

3条回答
  •  一个人的身影
    2020-12-29 06:34

    Use the built in method part of NSString:

    [testString rangeOfString:@"hello how are you doing"]
    

    Documentation: https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/doc/uid/20000154-rangeOfString_

提交回复
热议问题