Home » C programming language

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






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.