Go to the documentation of this file.
10 #ifndef CPROVER_UTIL_STRING_UTILS_H
11 #define CPROVER_UTIL_STRING_UTILS_H
19 std::string
capitalize(
const std::string &str);
41 bool remove_empty =
false);
61 typename TransformFunc>
66 const Delimiter &delimiter,
67 TransformFunc &&transform_func)
73 os << transform_func(*b);
74 for(
auto it=std::next(b); it!=e; ++it)
76 os << delimiter << transform_func(*it);
89 template <
typename Stream,
typename It,
typename Delimiter>
91 join_strings(Stream &&os,
const It b,
const It e,
const Delimiter &delimiter)
93 using value_type = decltype(*b);
96 os, b, e, delimiter, [](
const value_type &x) {
return x; });
101 std::string
escape(
const std::string &);
124 const std::string &line,
125 const std::size_t left_margin = 0,
126 const std::size_t width = 80);
144 const std::string::const_iterator left,
145 const std::string::const_iterator right,
146 const std::size_t left_margin = 0,
147 const std::size_t width = 80);
std::string wrap_line(const std::string &line, const std::size_t left_margin=0, const std::size_t width=80)
Wrap line at spaces to not extend past the right margin, and include given padding with spaces to the...
std::string escape(const std::string &)
Generic escaping of strings; this is not meant to be a particular programming language.
std::string capitalize(const std::string &str)
Stream & join_strings(Stream &&os, const It b, const It e, const Delimiter &delimiter, TransformFunc &&transform_func)
Prints items to an stream, separated by a constant delimiter.
void split_string(const std::string &s, char delim, std::string &left, std::string &right, bool strip=false)
std::string trim_from_last_delimiter(const std::string &s, const char delim)
std::string escape_non_alnum(const std::string &to_escape)
Replace non-alphanumeric characters with _xx escapes, where xx are hex digits.
std::string strip_string(const std::string &s)
Remove all whitespace characters from either end of a string.