std::string

Check if a string is alphanumeric in C++

In this article, we will learn how to check whether a string is alphanumeric or not in C++. Table Of Contents Problem Description Check if string is alphanumeric using std::count_if() Check if string is alphanumeric using std::all_of() Check if string is alphanumeric using std::find_if_not() Check if string is alphanumeric using std::isalnum() Summary Problem Description Our

Check if a string is alphanumeric in C++ Read More »

How to concatenate a string and int in C++?

In this article, we will discuss how to concatenate a string and an int in C++. Table Of Contents Introduction Method 1: Using std::stringstream() function Method 2: Use std::to_string() function Method 3: Using boost::lexial_cast<> from the Boost Library Summary Introduction We have given a string & an int, and we have to concatenate/merge them into

How to concatenate a string and int in C++? Read More »

Remove certain characters from a String in C++

In this article, we will learn how to remove certain characters from a string in C++. Table Of Contents Problem Description Method 1: Using while loop Method 2: Using STL function for_each(), erase() and remove() Special Notes about remove() and erase() Summary Problem Description Suppose we have a string sampleStr, and an array of characters

Remove certain characters from a String in C++ Read More »

Convert an Integer to a Hexadecimal String in C++

A hexadecimal string contains only hexadecimal digits and an optional “0x” prefix. The article here discusses various ways to convert an integer to a hexadecimal string (with the “0x” prefix). The converted string is in lowercase and can be converted to uppercase using toupper() function in C++. Table Of Contents Method 1: Using a For

Convert an Integer to a Hexadecimal String in C++ Read More »

Convert a Hexadecimal String to an Integer in C++

A hexadecimal string contains only hexadecimal digits and an optional “0x” prefix. The article here discusses various ways to convert a hexadecimal string (with the “0x” prefix) to its corresponding integer value (with a note included after each method containing the changes to be made in the code in case of the hexadecimal string not

Convert a Hexadecimal String to an Integer in C++ Read More »

Scroll to Top