• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Efficiently getting characters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Efficiently getting characters


  • Subject: Re: Efficiently getting characters
  • From: Douglas Davidson <email@hidden>
  • Date: Tue, 2 May 2006 16:01:06 -0700


On May 2, 2006, at 3:40 PM, John Nairn wrote:

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)


This note is intended for those who are writing subclasses of NSString. If you are not writing a subclass of NSString, you should ignore it. If you are not writing a subclass of NSString, you are not using the abstract implementation of getCharacters:range:. Instead, you are using an efficient implementation supplied by one of the standard concrete subclasses.


Douglas Davidson

_______________________________________________
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


  • Follow-Ups:
    • Re: Efficiently getting characters
      • From: Antonio Nunes <email@hidden>
    • Re: Efficiently getting characters
      • From: Nir Soffer <email@hidden>
References: 
 >Efficiently getting characters (From: John Nairn <email@hidden>)

  • Prev by Date: Re: Efficiently getting characters
  • Next by Date: Re: can't get DOMDocument from WebView
  • Previous by thread: Re: Efficiently getting characters
  • Next by thread: Re: Efficiently getting characters
  • Index(es):
    • Date
    • Thread