Re: Subclassing appendFormat: for NSMutableString?
Re: Subclassing appendFormat: for NSMutableString?
- Subject: Re: Subclassing appendFormat: for NSMutableString?
- From: "Dr. H. Nikolaus Schaller" <email@hidden>
- Date: Sun, 16 May 2004 18:42:34 +0200
Am 16.05.2004 um 17:59 schrieb Ondra Cada:
Ondra,
thanks! That is the solution.
Nikolaus
@implementation MyCountedMutableString
-(void)appendFormat:(NSString*)fmt,... {
va_list al;
va_start(al,fmt);
NSString *adding=[[[NSString alloc] initWithFormat:fmt arguments:al]
autorelease];
^^^^ this approach was the missing link in my thoughts ^^^^
va_end(al);
The only idea I have is use b) and leave out the appendFormat: method
and replace its calls by [myobject appendString:[NSString
stringWithFormat:...]]. It a little ugly and wasting space&time.
If the string format is @"***%@***" and the argument is let's say 10000
characters, the above solution needs to create a temporary string of
10006 characters with all the copying involved. So it should not be
called too often in a loop.
_______________________________________________
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.