• 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: I don't get how to cast an integer to string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I don't get how to cast an integer to string


  • Subject: Re: I don't get how to cast an integer to string
  • From: Sherm Pendley <email@hidden>
  • Date: Wed, 22 May 2002 08:53:09 -0400

On Wednesday, May 22, 2002, at 08:35 AM, Ted Petrosky wrote:

int j=65;

NSMutableString *aFormattedString = [[NSMutableString alloc]
initWithFormat:@"There are rows"];

[aFormattedString insertString:[j stringValue] atIndex:10];

If you want to interpolate the value of j into your string, why not just do it with initWithFormat? That's what that method is for; if you didn't want to interpolate anything into the result, initWithString would be faster.

[[NSMutableString alloc] initWithFormat: @"There are %i rows.", j];

sherm--


Never put off until tomorrow what you can do today. There might be a law against it by that time.
_______________________________________________
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.
References: 
 >I don't get how to cast an integer to string (From: "Ted Petrosky" <email@hidden>)

  • Prev by Date: Re: I don't get how to cast an integer to string
  • Next by Date: mySQL; Cocoa; dealing with german special chars
  • Previous by thread: Re: I don't get how to cast an integer to string
  • Next by thread: Re: [Slightly OT] Suggestion for PB...
  • Index(es):
    • Date
    • Thread