• 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: Fairly newbie question on strings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fairly newbie question on strings


  • Subject: Re: Fairly newbie question on strings
  • From: Ben Kazez <email@hidden>
  • Date: Thu, 26 Jan 2006 21:23:30 -0600

On Fri, 27 Jan 2006, at 00:47:47 +0000, Mike Abdullah wrote:

I have sort of 2 questions to do with strings.  Say I have a string
nameOfToday that the program has previously filled with the name of
todays date.  I then want to create a string from this that says
something like:

Today is Monday.

So I need to get the first bit of string: "Today is "
Add on to it nameOfToday
And then append on to that "."

What would be the best way of achieving this?  I am looking at
stringWithFormat of NSString.  Would this be the best choice?

My other question is that if I do use this method, is the string that
it returns autoreleased?  I see no mention of this in the
documentation, so I'm wondering if I'd have to manually autorelease
it myself.

To answer this question, since it hasn't been answered by previous replies: The returned string is autoreleased for you. More on this here:


<http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/ Tasks/MemoryManagementRules.html>

Ben
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: NSWindow and app unhiding
  • Next by Date: Re: -doSomethingTrivial: (was empty subject line)
  • Previous by thread: Re: Fairly newbie question on strings
  • Next by thread: Universal Binary & Mac OS 10.1
  • Index(es):
    • Date
    • Thread