String Manipulation Functions (string.h) II

This is the continuation of the article String
Manipulation Functions (string.h)
in which we’re discussing about
the string manipulation functions.


Here I have listed 8 functions along with their prototype (simplified) and
a short description.


One thing to note here is that unlike the last article on this topic, I have
not included example programs, since the functions (with their prototypes) are
pretty much straightforward.



strlwr:


Prototype: char *strlwr(char *)

This function converts the given string to lowercase and returns the same.


strupr:


Prototype: char *strupr(char *)

This function converts the given string to UPPERCASE and returns it.


strncat:


Prototype: strncat(char *str1, const char *str2, int n)

It appends first ‘n’ characters of str2 to the end of str1.


strncpy:


Prototype: int strncmp(char *str1, const char *str2, int n)

This function compares first ‘n’ characters of str1 with str2,
it returns 0 if compare was successful.


stricmp:


Prototype: int stricmp(const char *str1, const char *str2)

It compares two strings str1 and str2 without regard to case and returns
0 on being successful.


strnicmp:


Prototype: int strnicmp(const char *str1, const char *str2, int n)

This function compares first ‘n’ characters of str1 with str2
without regard to case.


strrev:


Prototype: char *strrev(char *)

This function reverses the given string and returns it.


stcstr:


Prototype: char *strstr(const char *str1, const char *str2)

This function returns the pointer to where the first occurrence of string
str2 is found inside str1.


Good-Bye!


Related Articles:


Check out this stream