Showing posts with label Types of C String functions. Show all posts
Showing posts with label Types of C String functions. Show all posts

Wednesday, 20 September 2017

What is String in c++

String 

A string is fundamentally an classification of characters which is finished by an invalid character '\0' which show the complete of the string.
Strings are always incase by two fold quotes.

This statement and instatement make a string with "NADI".
To hold the \0 (invalid character) around the complete of the group, the traverse of display is one more than the amount of characters in "NADI".
broil my_name[5] = {'N', 'A', 'D', 'I','\0'}; 

we can in like manner create the above clarification as takes after:
consume my_name[] = "NADI";
Sorts of C String limits
To use string limits programming engineer must import String.h header record.
String.h header record reinforces all the string limits in C vernacular.

Types of c++ string function 

if programmer write a program then must import string.h header file

There are following of string

strcat () it cocatenates string2 at enf of string1

2 strncat ( )  It add a portion of string to another

3 strcpy ( )  It Copies str2 into str1

4 strncpy ( ) copies given number of characters of one string to another

5 strlen ( ) gives the length of str1.

6 strcmp ( ) Returns 0 if str1 is same as str2. Returns 0 if str1 > str2.

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 str1.

9 strrchr ( ) last occurrence of given character in a string is found

10 strstr ( ) Returns pointer to first occurrence of str2 in str1.

11 strrstr ( ) Returns pointer to last occurrence of str2 in str1.

12 strdup ( ) duplicates the string

13 strlwr ( ) converts string to lowercase

14 strupr ( ) converts string to uppercase

15 strrev ( ) reverses the given string

16 strset ( ) sets all character in a string to given character

17 strnset ( ) It sets the portion of characters in a string to given character

18 strtok ( ) tokenizing given string using delimiter