Also, don't forget you can get a constant string instance like this: @"Quit"
So:
while(![@"Quit" isEqualToString:word2]) or while(![word2 isEqualToString:@"Quit"])Regards,
Ivan Vučica via phone You can't compare strings with "==", use "while([Quit isEqualToString: word2] == NO)" instead. In order for that to work, you'll need to setup word2 before comparing it, too. So either set it to nil first or use a do-while loop (probably what you want here, anyway).
Stef On Sat, Jan 29, 2011 at 9:03 AM, Parag Deshpande <parag.deshpande@studioapp.com> wrote:
Hi ,
i am trying to work with NSString object.The .m(source code) file is attached with this mail. Following is the description of my program.
I want to scan the NSString object for that i declare a char array and use stringWithCstring:arg encoding:NSASCIIStringEncoding scan is suucessful but my problem is in
while loop the condition of while i.e while(word2!=Quit) is not running .I mean when i enter "quit" through according logic it should exit while loop and from program. But it enter in endless loop .Please do write where am i went wrong.
Thank you.
_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnustep
|