• 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: casting an int to string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: casting an int to string


  • Subject: RE: casting an int to string
  • From: "Jonathan E. Jackel" <email@hidden>
  • Date: Wed, 22 May 2002 15:27:39 -0400

"Casting" from int to NSString doesn't seem possible, but what you really
seem to want is to insert a string representation of the integer into
another string. There is no "issue" with querying the tableView for the
number of rows or pushing the result into a string, at least none that I can
see. Just ask the tableView. You should be able to do:

NSString *message = [NSString stringWithFormat:@"There are %d
rows",[myTableView numberOfRows]];

Or perhaps

NSString *numOfRows = [NSString stringWithFormat:@"%d",[myTableView
numberOfRows]];
NSMutableString *message =[NSMutableString stringWithString:@"There are
rows."];
[message insertString:numOfRows atIndex:9];

Jonathan


> -----Original Message-----
> From: email@hidden
> [mailto:email@hidden]On Behalf Of Ted Petrosky
> Sent: Wednesday, May 22, 2002 3:18 PM
> To: email@hidden
> Subject: casting an int to string
>
>
> Thanks for all the recommendation that I got....
>
> It seems that everyone is of the mind that I should use some varient of
>
> @"the info %d here", int to get the integer in the string.
>
> Of course the issue is that I am querying a tableView for its
> number of Rows and
> pushing this int into the string.
>
> Interesting that when I first tried it, the compiler was
> complaining that the
> interger needed to be casted to string as I was trying to use the
> insert at index
> method.
>
> I don't know if there is a solution to cast an integer to string.
>
> Thanks again.
>
> Ted
> _______________________________________________
> 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.
_______________________________________________
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: 
 >casting an int to string (From: "Ted Petrosky" <email@hidden>)

  • Prev by Date: Font Activation and availableFonts
  • Next by Date: Re: desktop picture
  • Previous by thread: casting an int to string
  • Next by thread: Re: HOW-TO: Concatenating a string???
  • Index(es):
    • Date
    • Thread