I am just trying to compare a string from another string. But looks like strcmp() will compare only if both the words are of equal lenght or something.
My problem is, I am capturing a long string in my script. For ex:
text1="Hello my name is blah and blah";
if (strcmp(text1, "my name")==0)
else if (strcmp(text1,"is blah")==0)
But strcmp if always going to the end and failing the transaction even though the required words are in text1 string.
Can anyone suggest me how to handle this issue?
Thanks a lot
Try strstr(). It is likely a more appropriate use in this case since you are trying to test for "is contained in" versus "is equal to."
Replace ineffective offshore contracts, LoadRunnerByTheHour
. Starting @ $19.95/hr USD.
Put us to the test, skilled expertise is less expensive than you might imagine.
Twitter: @LoadRunnerBTH @PerfBytes
I don't have my "C" manual handy, so can't suggest a solution, but strcmp() compares 2 strings --- equal or unequal. It's not a search meachanism.