Number of occurrences of a substring in an NSString?

Posted by igul222 on Stack Overflow See other posts from Stack Overflow or by igul222
Published on 2010-01-30T04:10:05Z Indexed on 2010/05/02 12:58 UTC
Read the original article Hit count: 229

Filed under:
|
|
|

How can I get the number of times an NSString (for example, @"cake") appears in a larger NSString (for example, @"Cheesecake, apple cake, and cherry pie")?

I need to do this on a lot of strings, so whatever method I use would need to be relatively fast.

Thanks!

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa