Saturday, April 27, 2013

C Standard Library Inbuilt Function


With every C compiler, a large set of useful string handling library function are provided.
Below lists the more commonly used functions along with their name and features as:


 Function name  Features
 strlen()  Calculate length of string
 strcpy()  Copy from one string to another
 strncpy()  Copies first n characters of one string into another
 strcat()  Appends one string at the end of another
 strncat()  Appends first n characters of a string at the end of another
 strcmp()  Compares two string
 strncmp()  Compares first n characters of two string
 strcmpi()  Compares two string with ignore the case
 stricmp  Compares two string with ignore the case(identical to strcmpi)
 strnicmp  Compares first n characters of two string with ignore the case
 strlwr  Convert a string to lowercase
 strupr  Convert a string to uppercase
 strrev  Reverse string
 strdup  Duplicate a string
 strchr  Finds first occurrence of a given character in a string
 strrchr  Finds last occurrence of a given character in a string
 strstr  Finds first occurrence of a given string in another string
 strset  Sets all characters of string to a given character
 strnset  Sets first n characters of a string to a given character
Table: Standard Library String Function in C Language

(For syntax, example and use of above function, click at related function name.)

No comments:

Post a Comment