In this tutorial, we will discuss the String function in C programming Language
In this post, we are going to learn about pre-defined string functions in C language and how to use it
Strings are always enclosed by double quotes, Whereas , character is enclosed by single quotes in C likes other language
The string library function which is built in C language to handle of String with some readymade functions
String functions is used coping one string to other string, concatenates two strings , finding the length of the string,String comparison and replace or insert strings etc……
string.h header file supports all the string functions in C language. and String functions are given below
1. strcat ()- Concatenates two string, Str2 can be concatenates at the end of the str1
2. strncat() – Appends a portion of String to another
3. strcpy() – Copies String2 into String 1
4. strncpy() – Copies given number of characters of one String to another
5. strlen()- Gives the leanth of given String
6. strcmp() –
Return 0 value if String 1 is same as String 2.
Return < 0 ,if String 1<String 2.
Return >0 if String1>String2
7. strcmpi() – Same as strcmp() function but this function negotiates case “A” and “a” are treated as same
8. strchr() – Returns pointer to first occurrence of char in String 1
9. strrchr() – Last occurrence of given character in a String is found
10. strstr() – Return pointer to first occirrence of String 2 in String 1
11. strrstr() – Return pointer to last occirrence of String 2 in String 1
12. strdup() – Duplicates the given String
13. strlwr() – Convert string to lover case
14. strupr() – Convert string to upper case
15. strrev() – Reverses the given string
16. strset() – Sets all charecters in a string to given charecter
17. strnset() – It’s sets the portion of charecters in a string to given charecter
18. strtok() – Tokenizing given String using delimiter
Suggested post
Function in C language
Related