• 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: substring return a new string?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: substring return a new string?


  • Subject: Re: substring return a new string?
  • From: j o a r <email@hidden>
  • Date: Thu, 18 Mar 2004 09:00:51 +0100

"substringWithRange:" will create a new string, so you should be able
to simply retain it.

It's good that you ask though. I was just recently bitten by this
potential problem - using the string from a text view without a copy
(or other similar way to create a new string).
It created a problem that was very difficult to track down... The
returned string was stored in a dictionary, and I couldn't understand
why the strings changed under my feet. I verified that they looked OK
when set, but still they mutated... :)

j o a r

On 2004-03-18, at 07.41, Francisco Tolmasky wrote:

> When I have a textview, and call [[textview string]
> substringWithRange: someRange], if I want to save that string, do I
> need to send it the copy: message, or am I ok with just retaining it
> (given that the string in the textview will be edited).

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.


  • Follow-Ups:
    • Re: substring return a new string?
      • From: Ondra Cada <email@hidden>
References: 
 >substring return a new string? (From: Francisco Tolmasky <email@hidden>)

  • Prev by Date: Custom field editor to emulate LocationTextField (as in Safari) ?
  • Next by Date: A question about encoding
  • Previous by thread: substring return a new string?
  • Next by thread: Re: substring return a new string?
  • Index(es):
    • Date
    • Thread