VOOZH about

URL: https://www.geeksforgeeks.org/cpp/boostalgorithmjoin-in-cpp-library/

⇱ boost::algorithm::join() in C++ Library - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

boost::algorithm::join() in C++ Library

Last Updated : 9 Mar, 2022

The library Boot.StringAlgorithms provides many functions for string manipulations. The string can be of type std::string, std::wstring, or any instance of the class template std::basic_string.

boost::algorithm:join():

The join()  function in the C++ boost library is included in the library "boost/algorithm/string". This function is used to join two or more strings into one long string by adding a separator between the strings. The strings to be joined are provided in a container like a vector of string. Popular used containers are std::vector<std::string>, std::list<boost::iterator_range<std::string::iterator>.

Syntax:

join(container, separator)

Parameters:

  • container: It contains all the strings which have to be joined.
  • separator: It is a string that separates the joined strings.

 Example 1: Below is the C++ program to implement the above approach.

 
 


Output
Geeks For Geeks
Geeks$For$Geeks


 

 Example 2: Below is the C++ program to implement the above approach.


 

 
 


Output
Geeks...For...Geeks


 

Comment
Article Tags: