We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Category: std::string

C++ : How to split a string using String and character as Delimiter?

In this article we will see 2 techniques to split a std::string in C++ and return the result in std::vector<std::string> i.e. Splitting a std::string using a char as delimiter. Splitting a std::string using an another std::string as delimiter. How to Split a std::string using a char as delimiter: In this we will convert the passed …

C++ : How to split a string using String and character as Delimiter?Read More

How to trim strings in C++ using Boost String Algorithm Library

In this tutorial we will discuss how to use trim algorithms from C++ Boost String Algorithm Library. Let’s learn them step by step, Boost String algorithm library provides different algorithms for string trimmings. Let’s first discuss the simple one i.e, What if we want to trim the string of white spaces from left side or …

How to trim strings in C++ using Boost String Algorithm LibraryRead More

Implementing a Case Insensitive string::find in C++

In this article we will discuss how to find a Case Insensitive Sub String in a given string in C++ using, STL Boost Library std::string provides a method std::string::find to search for the sub string inside a given string, but this function is case sensitive i.e. Advertisements std::string data = “Hi this is a sample …

Implementing a Case Insensitive string::find in C++Read More

Convert First Letter of each word of a String to Upper Case in C++

In this article we will discuss different ways to convert first letter of each word to upper case in a a given string i.e. Using STL algorithm Using Boost Filtered Iterator & Range Converting First Letter to Upper Case using STL Algorithm Used: Iterate over the characters in given string For each character check – …

Convert First Letter of each word of a String to Upper Case in C++Read More

Convert a String to Uppercase or LowerCase in C++

In this article, we will discuss different ways to convert a string to upper case or lower case in C++. Table Of Contents Using STL using Boost String Algorithm Library Convert a String to Upper Case using STL C++ provides a function ::toupper() that converts a character to upper case character i.e. Advertisements int toupper ( …

Convert a String to Uppercase or LowerCase in C++Read More

Find and Replace all occurrences of a sub string in C++

In this article we will discuss how to replace all occurrences of a sub string with new string in C++. For example, we have a string i.e. Advertisements “Boost Library is simple C++ Library” And we want replace all occurrences of ‘Lib’ with XXX. Let’s see the different methods to do it, Frequently Asked: Implementing …

Find and Replace all occurrences of a sub string in C++Read More

Find all occurrences of a sub string in a string | C++ | Both Case Sensitive & InSensitive

In this article we will discuss how to find all occurrences / Positions of a sub string in a given string in both case sensitive & case insensitive manner. Find All Case Sensitive Occurrences of a Sub String in a given String Logic: Use std::string::find to search the first occurrence and then go on searching using …

Find all occurrences of a sub string in a string | C++ | Both Case Sensitive & InSensitiveRead More

C++ : Convert double to string and manage precision | scientific notation

In this article we will discuss different ways to convert double to String or char array with or without precision i.e. double to String using C++11’s std::to_string std::to_string is introduced in c++11. Example to convert double to std::string using to_string is as follows, Advertisements double num = 6789898989.33999443; //Converting using std::to_string std::string str = std::to_string(num); …

C++ : Convert double to string and manage precision | scientific notationRead More

C++ : Check if a String starts with an another given String

In this article we will discuss both case sensitive and insensitive implementations to check if a string starts with an another given string. In c++, std::string class does not provides any startsWith() function to check if a string starts with an another given string. Let’s see how to do that using std::string::find and Boost Library. Advertisements …

C++ : Check if a String starts with an another given StringRead More

C++ : How to check if a String Ends With an another given String

In this article we will discuss both case sensitive and insensitive implementations to check if a string ends with an another given string. In previous article we discussed different implementations of startsWith() function for std::string. Here on similar lines we will discuss different implementations of endsWith() function. Advertisements In c++, std::string class does not provides any …

C++ : How to check if a String Ends With an another given StringRead More

Cart

Your Cart is Empty

Back To Shop