Tag Archives: cpp-strings-library

What is string::npos: It is a constant static member value with the highest possible value for an element of type size_t. It actually means until… Read More
Given a string S and a character C, the task is to remove all the occurrences of the character C from the given string. Examples:… Read More
Using inbuilt function Using the inbuilt function strcpy() from string.h header file to copy one string to the other. strcpy() accepts a pointer to the… Read More
Given a String str containing only lowercase English alphabets and an integer K. The task is to check that whether the string can be converted… Read More
Given three strings(without spaces). The task is to print the new string after modifying the three given string as follows: Replace all the vowels present… Read More
Given a string and an integer M, print all distinct circular strings of length M in lexicographical order. Examples: Input: str = “baaaa”, M =… Read More
Member functions String.constructor :  Construct string object (public member function ). String.destructor : String destructor (public member function ) String.operator= : String assignment (public member function… Read More
In C++, std::strstr() is a predefined function used for string handling. string.h is the header file required for string functions. This function takes two strings… Read More
Converts the value ch to unsigned char and copies it into each of the first n characters of the object pointed to by str[]. If… Read More
std::strncmp() function lexicographically compares not more than count characters from the two null-terminated strings and returns an integer based on the outcome. This function takes… Read More
In this article, we are going to inspect three different ways of initializing strings in C++ and discuss differences between them. 1. Using char* Here,… Read More
C++ STL offer many utilities to solve basic common life problems. Comparing values are always necessary, but sometimes we need to compare the strings also.… Read More
std::string::at can be used to extract characters by characters from a given string. It supports two different syntaxes both having similar parameters: Syntax 1: char&… Read More
Parses string interpreting its content as a floating-point number, which is returned as a value of type float. Syntax : float stof (const string& str,… Read More
It searches the string for the first character that does not match any of the characters specified in its arguments. Return value : Index of… Read More