Efficiently getting characters
Efficiently getting characters
- Subject: Efficiently getting characters
- From: John Nairn <email@hidden>
- Date: Tue, 2 May 2006 15:40:43 -0700
I am using NSString method
- (void)getCharacters:(unichar *)buffer range:(NSRange)aRange
to get characters from a long string. Unfortunately, there is a note
in the documentation that says
The abstract implementation of this method uses
characterAtIndex: repeatedly,
correctly extracting the characters, though very inefficiently.
Subclasses should
override it to provide a fast implementation.
but there is no indication how to do it efficiently (or why NSString
didn't bother to do it efficiently in the first place)
What is the best way to extract a range of characters from an
NSString? The problem is important when I open a large file which
could involve extracting thousands or millions of ranges of characters.
---------------
John Nairn (1-541-737-4265, FAX:1-541-737-3385)
Professor and Richardson Chair
Web Page: http://woodscience.oregonstate.edu/faculty/nairn (under
construction)
FEA/MPM Web Page: http://oregonstate.edu/~nairnj
_______________________________________________
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