Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can i check in a char[4000] if a rule of text exist?
Posted

The function strstr[^] can find a sub string in a string and return its location.
char szHaystack[] = "hello world";
char *szNeedle = strstr(szHaystack, "lo");
if (szNeedle == NULL) {
	printf("The string \"lo\" was not found.\n");
} else {
	printf("The string \"lo\" was found %u characters from the start.\n", szNeedle - szHaystack);
}
 
Share this answer
 
Comments
#realJSOP 7-Feb-11 11:12am    
Propose as answer
You can use strstr[^] to search for a string in a string.
 
Share this answer
 
Your question is a little bit hard to understand, but I think what you are looking for can be found here.
 
Share this answer
 
Comments
Espen Harlinn 7-Feb-11 16:10pm    
a 5 :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900