objective c - Why is my comparing if statement not working? -


Why is not the following code (in cocoa) working?

  NSString * extension = [filename pathextension]; NSString * wantedExtension = @ "MP3"; Execoded in (Exchanges == Expected Extension) {// work}  

It runs only without warnings or errors, but I do not think what this should do.

this should not be

  if ([extension isEqualToString: wantedExtension ]} {...}  

"==" Indicators compare Excel: and avatostring: Compare strings, although excelstostring is better if you want both expansions and know Extensions are NSString (which you do in this case).

Actually, if you like the old C ++ and Java programmers like me, you can be happy that the person who is not going to be futile, "desired extension", first. Objective in C is not necessary because "sending zero messages" (i.e. while calling method) returns zero or 0 returns 0 or wrong.

  If ([wanted interstation is EqualToString: extension]) {...}  

Comments