A common practice among programmers is manipulating string data, such as copying one string into another and concatenating strings to each other. Also common is the need to convert strings to either all lowercase or all uppercase, which can be important when comparing one string to another. we will show you how to perform these string manipulations in the following tutorial.
Before reading this tutorial you should know what is strings and how to declare and initialize it in c language.
C String Manipulation Functions
All of the string functions are defined in
String.h header file in C language.
Few commonly used string handling functions are discussed below:
|strlen()||Calculates the length of string|
|strcat()||Concatenates(joins) two strings|
|strncat()||Appends a portion of string to another|
|strcpy()||Copies a string to another string|
|strncpy()||Copies number of characters of one string to another|
|strcmp()||Compares two strings|
|strncmp()||compares at most the first n bytes of str1 and str2.|
|strchr()||Returns pointer to first occurrence of char|
|strrchr()||Return last occurrence of given character in a string is found|
|strstr()||Returns pointer to the first occurrence of the string|
|strdup()||Duplicates the string|
|strndup()||Similar to strdup(), but copies at most n bytes.|
|strerror()||Returns the error message|
|strtok()||Tokenizing given string using delimiter|
|strcoll()||Compares first string with another.|