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
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
if ([theName isEqualToString:@John Lennon])
{
theName = @Ringo Starr;
}
--
By using == you were checking to see if the strings were the same
object. Sometimes this would, sometimes it would not. Instead, you
want to check if the two objects have equivalent contents.
Hi,
Check Google. Just type in examples of if() conditionals (with the
quotes).
Hope this helps,
Dan
On Jun 25, 2008, at 8:24 AM, Papa-Raboon wrote:
Hi All,
Anybody know where can I get some examples of if() conditionals
being used
with string variables in Objective-C?
To be
On Wed, Jun 25, 2008 at 10:51 AM, Dan Uff [EMAIL PROTECTED] wrote:
Check Google. Just type in examples of if() conditionals (with the
quotes).
Perhaps you skimmed the original request - the problem was really
how to compare NSString instances ( if() not withstanding).
--
I.S.
You can do:
if([theName isEqualToString:@John Lenon])
//do stuff
NSString has some comparison methods in the class listing. The above
example will ask two different NSString objects if they have the same
string values.
On Jun 25, 2008, at 8:24 AM, Papa-Raboon wrote:
Hi All,