#include <string.h>
strcpy – Copy string into string
strcpy(s1, s2);
Copies string s2 into string s1.
strcat – Add string to end of string
strcat(s1, s2);
Concatenates string s2 onto the end of string s1.
strlen – Get string length
strlen(s1);
Returns the length of string s1.
strcmp – Compare strings
strcmp(s1, s2);
Returns 0 if s1 and s2 are the same; less than 0 if s1<s2; greater than 0 if s1>s2.
strchr – Find character in string
strchr(s1, ch);
Returns a pointer to the first occurrence of character ch in string s1.
strstr – Find String in string
strstr(s1, s2);
Returns a pointer to the first occurrence of string s2 in string s1.
Examples
Creating A String
char StatusString[255];
strcpy(StatusString, "<span font_desc=\"Arial 16\">Hello");
strcat(StatusString, " World\n");
strcat(StatusString, "</span>");
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.