views:

74

answers:

1

please tell me how to compare 2 string variables i am not talking about a string variable and a string(that is already give in this site i tried it

if (s isEqualToString: str) {
  // ...
} 

here s ans ss are two NSMutableStrings already having values .... but this doesnot work i also tried isEqual but failed again please help remember 2 string variables.... sorry for bad english....

+4  A: 

You're missing brackets.

if ([s isEqualToString:ss]) {
    // ...
}

You can't just use ==, because a string with the same content may be stored in different objects.

jtbandes
oh....its working thank you very much sir....
Online