Le 25 juin 08 à 14:24, Papa-Raboon a écrit :

Hi All,

Anybody know where can I get some examples of if() conditionals being used
with string variables in Objective-C?

To be specific, I am trying to use an if conditional to check the value of a string being a certain value and then replacing it with a different value if
the condition returns TRUE.
Currently I have:

NSString *theName = [NSString stringWithFormat:@"%@ %@", [firstName
stringValue], [lastName stringValue]];

I thought that this would work but it doesn't:

if ([NSString theName] == @"John Lenon") {

// then something here using setStringValue but haven't got a clue how to do
this.

}

I want to check if "theName is currently "John Lenon" and change it to be
"Ringo Starr".

Any help would be greatly appreciated thanks as I am a complete newbie and
need to get my head around many things in Objective-C.

Thanks

Paul Randall

Check this complete NSString programming guide, and if you don't find what you need, ask again.

http://developer.apple.com/documentation/Cocoa/Conceptual/Strings/introStrings.html

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

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to