I was wondering if there was an easy method to find the amount of times a character such as ‘$’ shows up in a string in the language objective-c.
The real world example I am using is a string that would look like:
542$764$231$DataEntry
What I need to do is first:
1) count the amount of times the ‘$’ shows up to know what tier the DataEntry is in my database (my database structure is one I made up)
2) then I need to get all of the numbers, as they are index numbers. The numbers need to be stored in a NSArray. And I will loop through them all getting the different indexes. I’m not going to explain how my database structure works as that isn’t relevant.
Basically from that NSString, I need, the amount of times ‘$’ shows up. And all of the numbers in between the dollar signs. This would be a breeze to do in PHP, but I was curious to see how I could go about this in Objective-C.
Thanks,
Michael
1 Answer