• 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: Subclassing appendFormat: for NSMutableString?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >keeping tooltips from wrapping (From: Mark Munz <email@hidden>)
 >Subclassing appendFormat: for NSMutableString? (From: "Dr. H. Nikolaus Schaller" <email@hidden>)
 >Re: Subclassing appendFormat: for NSMutableString? (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: IB calling init of AppKit subclass [was Re: Window Styles]
  • Next by Date: Simulating cmd-click-lock on window title-bar?
  • Previous by thread: Re: Subclassing appendFormat: for NSMutableString?
  • Next by thread: Re: Subclassing appendFormat: for NSMutableString?
  • Index(es):
    • Date
    • Thread