×

C Tutorial

C Basics

C Data Types

C Input/Output

C Operators

C Conditional Statements

C Control Statements

C Strings

C Functions

C Arrays

C Structure and Unions

C Pointers

C Preprocessor Directives

C Command-line Arguments

C File Handlings

C Graphics

C Advance Topics

C Tips and Tricks

C Important Topics

C Practice

Standard Library String functions in C language

In this article, we will learn about some Standard Library String Functions in C programming language.
Submitted by Sneha Dujaniya, on July 22, 2018

Standard Library String functions

Mostly, every C compiler provides a set of useful library functions for handling strings. Here is a list of more commonly used functions with their uses:

Function Use
strlen To find length of a string
strlwr To convert all characters of a string to lowercase
strupr To convert all characters of a string to uppercase
strcpy To copy one string into another
strncpy To copy first n characters of a string into another
strdup To duplicate a string
strrev To reverse a string
strcat To append one string at the end of another string
strncat To append first n characters of a string at the end of another
strcmp To compare two strings
strncmp To compare first n characters of two strings
strcmpi To compare two strings without regarding the case(“I” denotes the func. Ignores case)
stricmp Similar to strcmpi
strnicmp To compare first n characters of two strings without regarding case
strchr To find first occurrence of a given ‘character’ in a string
strrchr To find last occurrence of a given ‘character’ in a string
strstr To find first occurrence of a given ‘string’ in another string
strset Sets all characters of a string to a given character
strnset Sets first n characters of a string to a given character

String Library Functions with Examples


Related Tutorials



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.