Re: create NSMutableString with no limit?
Re: create NSMutableString with no limit?
- Subject: Re: create NSMutableString with no limit?
- From: Andy Lee <email@hidden>
- Date: Sat, 18 Mar 2006 17:48:13 -0500
On Mar 18, 2006, at 5:37 PM, James W. Walker wrote:
What's the right way to create an NSMutableString with no limit on
its capacity? The only initialization method listed in the docs is
initWithCapacity, and it doesn't say you can pass 0 as the
capacity. I can take advantage of toll-free bridging and say
(NSMutableString*)CFStringCreateMutable( NULL, 0 ), but there must
be a more obvious way.
NSMutableStrings don't have a limit on their capacity. The argument
to -initWithCapacity: is just the amount of storage to initially
allocate. This way, if you know the string will never grow beyond
that amount, it doesn't have to reallocate memory as the string
grows. In most cases the performance gain is negligible, but if
you're doing tons and tons of appends to the string, it might help.
--Andy
_______________________________________________
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