Finding count of a character in a string
Finding count of a character in a string
- Subject: Finding count of a character in a string
- From: Paul Harvey <email@hidden>
- Date: Mon, 22 Aug 2005 09:49:11 +0100
To find out how many of a particular character there was in large
string, I used 'componentsSeparatedByString' method of NSArray then
used [array count] to find out how many there were.
Is there a better way, or is this a typical route?
NSArray *verses = [NSArray alloc];
verses = [chapterText componentsSeparatedByString:@"\n"];
verseCount = [verses count];
--
Paul Harvey
Lead Programmer
email@hidden
Hiddenfield Software
"Creating useful software for Mac OS X"
www.hiddenfield.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden