String Handling Functions In C
Posted by
Ravi Kumar at Friday, September 23, 2011
Share this post:
|
With every C compiler a large set of useful string
handling library functions are provided. The following figure
illustrates the more commonly used functions along with their
purpose.
1.strlen: Finds length of a string
2.strlwr: Converts a string to lower case
3.strupr: Converts a string to upper case
4.strcat: Appends one string at the end of the other
5.strncat: Appends first n characters of a string at
the end of another
6.strcpy: Copies a string into another
7.strncpy: Copies first n characters of one string into
another
8.strcmp: Compares two strings
9.strncmp: compares first n characters of two strings
10.strcmpi: compares two strings without regard to case
11.strnicmp: compares first n characters of two strings
without regard to case
12.strdup: duplicates a string
13.strchr: finds first occurrence of a given character in a
string
14.strrchr: Finds last occurrence of a given character in a
string
15.strstr: Finds first occurrence of a given string in another
string
16.strset: Sets all characters of string to a given character
17.strnset: Sets first n characters of a string to a given
character
18.strrev: Reverses string