General Utility Library for C++14  2.11
Namespaces | Functions
join_split.h File Reference

Detailed Description

Implementation of join(), split(), and split_sv().

Authors
General Utility Library Contributors
Date
Created on 31 August 2018

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2.1 of the license, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see https://www.gnu.org/licenses/.

#include <iterator>
#include <regex>
#include <string>
#include <type_traits>
#include <vector>
#include "gul14/internal.h"
#include "gul14/string_util.h"
#include "gul14/string_view.h"
Include dependency graph for join_split.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 gul14
 Namespace gul14 contains all functions and classes of the General Utility Library.
 

Functions

template<typename StringContainer = std::vector<std::string>, typename ContainerInsertFct = void (*)(StringContainer&, string_view)>
StringContainer gul14::split (string_view text, string_view delimiter, ContainerInsertFct insert_fct=detail::emplace_back< StringContainer >)
 Separate a string at all occurrences of a delimiter, returning the strings between the delimiters in a container. More...
 
template<typename StringContainer = std::vector<std::string>, typename ContainerInsertFct = void (*)(StringContainer&, string_view)>
StringContainer gul14::split (string_view text, const std::regex &delimiter, ContainerInsertFct insert_fct=detail::emplace_back< StringContainer >)
 Separate a string at all occurrences of a delimiter described by a regular expression, returning the strings between the delimiters in a container. More...
 
template<typename StringContainer = std::vector<string_view>, typename ContainerInsertFct = void (*)(StringContainer&, string_view)>
StringContainer gul14::split_sv (string_view text, string_view delimiter, ContainerInsertFct insert_fct=detail::emplace_back< StringContainer >)
 Separate a string at all occurrences of a delimiter, returning the strings between the delimiters in a vector. More...
 
template<typename Iterator >
std::string gul14::join (Iterator begin, Iterator end, string_view glue)
 Concatenate all strings in a range, placing a delimiter between them. More...
 
template<typename StringContainer >
std::string gul14::join (const StringContainer &parts, string_view glue)
 Concatenate all strings in a range, placing a delimiter between them. More...