• 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: How to concatenate two values?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to concatenate two values?


  • Subject: Re: How to concatenate two values?
  • From: Chris Garaffa <email@hidden>
  • Date: Thu, 03 Mar 2005 18:32:22 -0500

Title: Re: How to concatenate two values?
From: Ronald Hofmann <email@hidden>
Date: Thu, 3 Mar 2005 15:20:03 +0100


My problem is as follows:
I have values which already work fine.

 NSCalendarDate *now=[NSCalendarDate calendarDate];//this is a date
value
 NSString *myPath = NSHomeDirectory();//this is a string value

I want to concatenate both values.

Try something like this (untested, written in Entourage):

NSString *newString = [[NSString alloc] initWithFormat: @”%@%@”, myPath, [now description]];

Check the NSCalendarDate documentation for the method –descriptionWithCalendarFormat, which will allow you to specify how the date is displayed.


Alternatively, I’m 99% sure you could also do this:
NSMutableString *newString = [NSHomeDirectory() mutableCopy];
[newString appendString: [now description]];

Which would remove the need for the myPath variable.

HTH

--
Chris Garaffa
Technician

TracyLocke
 _______________________________________________
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

References: 
 >How to concatenate two values? (From: Ronald Hofmann <email@hidden>)

  • Prev by Date: Re: How to concatenate two values?
  • Next by Date: Re: How to concatenate two values?
  • Previous by thread: Re: How to concatenate two values?
  • Next by thread: How to concatenate two values?
  • Index(es):
    • Date
    • Thread