• 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: NSMutableString appendString: "appending self" allowed?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMutableString appendString: "appending self" allowed?


  • Subject: Re: NSMutableString appendString: "appending self" allowed?
  • From: Ali Ozer <email@hidden>
  • Date: Thu, 30 Aug 2007 09:51:09 -0700

Unfortunately not guaranteed in the general case, although it should work with regular NSMutableString in 10.4 and newer. The fix that guaranteed it would work wasn't there pre-10.4, but it could still work in many cases in practice.

It does not work with the backing store for the text system (NSTextStorage).

Ali

On Aug 29, 2007, at 21:46 , Manfred Schwind wrote:

Hi,

is the following call allowed?

[someMutableString appendString:someMutableString];

It effectively appends a given string to itself, so that it gets doubled. (E.g. "Oh" will become "OhOh" etc.)

It works at least on 10.4.10, but it's not documented wether I can use the receiver as parameter in the appendString selector for NSMutableString. Can someone (maybe from Apple) approve that this works also for older system versions?
I can think of strange side effects when appending a string to itself, depending on the internal implementation.


Or should I better use this:

[someMutableString appendString:[[someMutableString copy] autorelease]];

or

[someMutableString appendString:[someMutableString subStringToIndex: [someMutableString length]]];

or something like that?

Regards,
Mani
--
http://www.mani.de
iVolume - Loudness adjustment for iTunes.
LittleSecrets - The encrypted notepad.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NSMutableString appendString: "appending self" allowed? (From: Manfred Schwind <email@hidden>)

  • Prev by Date: Re: interface to metadata list
  • Next by Date: byte swapping large chunks of data
  • Previous by thread: Re: NSMutableString appendString: "appending self" allowed?
  • Next by thread: How to create .widgetplugin with java source file??
  • Index(es):
    • Date
    • Thread