Strings

Built in functions of String :

strcpy (char *s1, char *s2);

Copy s2 string into s1 string. This function works like assignment operator for strings that copies contents of one string into another string.

strncpy(char *string1, char *string2, int n);
Copy first n characters of string2 to stringl .


int strcmp(char *string1, char *string2);
Compare string1 and string2 to determine alphabetic order.


int strncmp(char *string1, char *string2, int n);
Compare first n characters of two strings.


int strlen(char *string);
Determine the length of a string.


strcat(char *dest, const char *src);
Concatenate string src to the string dest.


strncat(char *dest, const char *src, int n);
Concatenate n chracters from string src to the string dest.


strchr(char *string, int c);
Search for first occurrence of character c in string.


strrchr(char *string, int c);
Search for occurrence of character c in string.

strstr(char *string2, char string*1);
Search for  occurrence of string string1 in string2.

strtok(char *s, const char *delim) ;
Parse the string s into tokens using delim as delimiter.

Comments