std::string

Convert Long to String in C++ | (3 ways)

In this article, we will learn about three different ways to convert a long to a string in C++ i.e. Using to_string() function Using stingstream Using Boost’s lexical_cast() function. Let’s discuss them one by one. Convert long to string using to_string() C++ provides a function std::to_string() for converting values of different types to string type. …

Convert Long to String in C++ | (3 ways) Read More »

Convert double to string in C++ – (3 ways)

In this article, we will learn about three different ways to convert a double to a string in C++ i.e. Using std::to_string() function Using std::stingstream Using Boost’s lexical_cast() function. Let’s discuss them one by one. Convert double to string using to_string() C++ provides a function std::to_string() for data type conversion. We can use this to …

Convert double to string in C++ – (3 ways) Read More »

Convert float to string in C++ (3 Ways)

In this article, we will learn about three different ways to convert a float to a string in C++ i.e. Using std::to_string() function Using std::stingstream Using Boost’s lexical_cast() function. Let’s discuss them one by one. Convert float to string using to_string() C++ provides a function std::to_string() for data type conversion. We can use this to …

Convert float to string in C++ (3 Ways) Read More »

C++ – Check if string contains a character

In this article, we will learn about three different ways to check if a string contains a character or not. Check if a string contains a character using string::find() In C++, the string class provides different overloaded versions of function find() to search for sub-strings or characters in the string object. In one of the overloaded versions, …

C++ – Check if string contains a character Read More »

C++ – Convert int to string (3 ways)

In this article, we will learn about three different ways to convert an integer to a string in C++ i.e. Using to_string() function Using stingstream Using Boost’s lexical_cast() function. Let’s discuss them one by one. Convert int to string using to_string() C++ provides a function std::to_string() for converting values of different types to string type. …

C++ – Convert int to string (3 ways) Read More »

Scroll to Top