Re: counting characters
Re: counting characters
- Subject: Re: counting characters
- From: Pandaa <email@hidden>
- Date: Thu, 15 Apr 2004 02:30:42 +0200
Hi,
To count the occurance of characters or a group of characters in an
NSString, I now use a for loop, and compare each character with an
NSCharacterSet. It works fine, but I was wondering if I can do this
easier/more efficiently using an NSScanner.
Use scanCharactersFromSet:intoString: and check the length of the
resulting string?
Will probably be faster as long as your string isn't too large ( if
it's more than a few MBs I imagine the memory overhead of creating and
copying data to a new string may begin to be costy ).
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .
. . . . earth water fire air software - the five elements . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .
. email@hidden . . www.synapticpulse.net .
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.