Re: substring return a new string?
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.