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

RE: NSString newbie question


  • Subject: RE: NSString newbie question
  • From: "Kenny Millar" <email@hidden>
  • Date: Wed, 15 Mar 2006 16:14:27 -0000
  • Organization: Kenny Millar

I would do something like this...

One single line...
[ratingTextOutlet setStringValue:[NSString stringWithFormat:@"Rating:
%@/10",[ratingOutlet stringValue]]];

-Kenny

-----Original Message-----
From: cocoa-dev-bounces+kennymillar=email@hidden
[mailto:cocoa-dev-bounces+kennymillar=email@hidden] On Behalf Of
Bobby B
Sent: 15 March 2006 16:07
To: email@hidden
Subject: NSString newbie question

Hello everyone,

This is my 2nd post here.  My first post was about class methods (the
conveinence constructors) - thank you all for the help!  You guys
totally made all of that stuff clear to me!

I have a question about strings now.  There is something fundamental I
think that I'm not getting.

I'm used to being able to manipulate a string like this pseudocode:

var myStr : string;
var xStr = " World";
myStr = "Hello";
myStr = myStr + xStr
print myStr
"Hello World"

I'm trying to do something similar w/ ObcJ/Cocoa, and I've come up with
this:

NSString * myStr = @"Rating: (";
NSString * myStr1 = [myStr stringByAppendingString:[ratingOutlet
stringValue]];
NSString * myStr2 = [myStr1 stringByAppendingString:@"/10)"];

[ratingTextOutlet setStringValue:myStr2];

It seems that the only way I can get what I want is to declare a new
nsstring variable each time I need to append something.  Does that
seem right?  I've read all the nsstring tutorials I could find on
different sites.  Is this just the way?

Thank you
Bobby B
 _______________________________________________
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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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: 
 >NSString newbie question (From: "Bobby B" <email@hidden>)

  • Prev by Date: Re: NSString newbie question
  • Next by Date: Re: NSString newbie question
  • Previous by thread: Re: NSString newbie question
  • Next by thread: Re: NSString newbie question
  • Index(es):
    • Date
    • Thread