• Advertisement

Archived

This topic is now archived and is closed to further replies.

String Comparison

This topic is 6020 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m trying to see if a character array contains certain phrase or word, how do I check a character array for this ie...
  

if(String1 == "Quit")
{
     break;
}

  

Share this post


Link to post
Share on other sites
Advertisement
use strcmp().

it returns zero if the strings are the same, so some people like to do a little #define to make the syntax nicer....

#define StringMatch(a,b) (strcmp(a,b) == 0)

Share this post


Link to post
Share on other sites

  • Advertisement