13#ifndef ROOT_StringUtils
14#define ROOT_StringUtils
26std::vector<std::string>
Split(std::string_view str, std::string_view delims,
bool skipEmpty =
false);
35std::pair<std::string_view, std::string_view>
SplitAt(std::string_view str,
char splitter);
45template <
typename InputIt_t>
46std::string
Join(
const std::string &sep, InputIt_t begin, InputIt_t end)
51 return std::accumulate(std::next(begin), end, *begin, [&sep](
auto const &
a,
auto const &
b) {
return a + sep +
b; });
61template <
class StringCollection_t>
62std::string
Join(
const std::string &sep, StringCollection_t &&strings)
64 return Join(sep, std::begin(strings), std::end(strings));
67std::string
Round(
double value,
double error,
unsigned int cutoff = 1, std::string_view delim =
"#pm");
69inline bool StartsWith(std::string_view
string, std::string_view prefix)
71 return string.size() >= prefix.size() &&
string.substr(0, prefix.size()) == prefix;
74inline bool EndsWith(std::string_view
string, std::string_view suffix)
76 return string.size() >= suffix.size() &&
string.substr(
string.
size() - suffix.size(), suffix.size()) == suffix;
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
bool EndsWith(std::string_view string, std::string_view suffix)
std::string Join(const std::string &sep, InputIt_t begin, InputIt_t end)
Concatenate a list of strings with a separator.
bool StartsWith(std::string_view string, std::string_view prefix)
std::string Round(double value, double error, unsigned int cutoff=1, std::string_view delim="#pm")
Convert (round) a value and its uncertainty to string using one or two significant digits of the erro...
std::vector< std::string > Split(std::string_view str, std::string_view delims, bool skipEmpty=false)
Splits a string at each character in delims.
std::pair< std::string_view, std::string_view > SplitAt(std::string_view str, char splitter)
Given a string str, returns a pair of string views into it: the first containing the substring preced...