I'm just working on my very first Cocoa project. I already know a number of other languages such as C / C++ / C# / Java etc..
I'm actually trying to accomplish a simple task: Finding the number of occurences of the character '-' in an NSString. Now, I could write a 6 line while loop to do this for me, but to be honest, I expected the Cocoa framework to have a method for me?
I could only think of one alternative way: rangeOfCharacterFromSet. And then looping that until the end of the string (but this would be inferior to looping once, of course..).
Have I missed a vital search keyword on google (I could not find a -single- article about finding the number of occurences in an NSString)? I did find a some articles about having a CountedSet, but you would have to have an array? (Do I have to go back to char arrays??).
I would appreciate some hints as a first time user. Thanks!
I'm actually trying to accomplish a simple task: Finding the number of occurences of the character '-' in an NSString. Now, I could write a 6 line while loop to do this for me, but to be honest, I expected the Cocoa framework to have a method for me?
I could only think of one alternative way: rangeOfCharacterFromSet. And then looping that until the end of the string (but this would be inferior to looping once, of course..).
Have I missed a vital search keyword on google (I could not find a -single- article about finding the number of occurences in an NSString)? I did find a some articles about having a CountedSet, but you would have to have an array? (Do I have to go back to char arrays??).
I would appreciate some hints as a first time user. Thanks!