|
doxygen
|
Some helper functions for std::string. More...
#include <string>#include <string_view>#include "containers.h"#include "regex.h"

Go to the source code of this file.
Functions | |
| void | substituteInplace (std::string &s, std::string_view toReplace, std::string_view replaceWith) |
| Replaces occurrences of substring toReplace in string s with string replaceWith. More... | |
| std::string | substituteStringView (std::string_view s, std::string_view toReplace, std::string_view replaceWith) |
| Returns a new string where occurrences of substring toReplace in string s are replaced by string replaceWith. | |
| std::string_view | stripWhiteSpace (std::string_view s) |
| Given a string view s, returns a new, narrower view on that string, skipping over any leading or trailing whitespace characters. | |
| void | addTerminalCharIfMissing (std::string &s, char c) |
| template<size_t N> | |
| bool | literal_at (const char *data, const char(&str)[N]) |
| returns true iff data points to a substring that matches string literal str | |
| template<size_t N> | |
| bool | literal_at (std::string_view data, const char(&str)[N]) |
| returns true iff data points to a substring that matches string literal str | |
| StringVector | split (const std::string &s, const std::string &delimiter) |
| split input string s by string delimiter delimiter. More... | |
| StringVector | split (const std::string &s, const reg::Ex &delimiter) |
| split input string s by regular expression delimiter delimiter. More... | |
| std::string | join (const StringVector &sv, const std::string &delimiter) |
| create a string where the string in the vector are joined by the given delimiter | |
| size_t | findIndex (const StringVector &sv, const std::string &s) |
| find the index of a string in a vector of strings, returns std::string::npos if the string could not be found | |
| size_t | findIndex (const std::string &s, const reg::Ex &re) |
| find the index of the first occurrence of pattern re in a string s returns std::string::npos if the pattern could not be found | |
| std::string | removeEmptyLines (const std::string &s) |
Some helper functions for std::string.
|
inline |
split input string s by string delimiter delimiter.
returns a vector of non-empty strings that are between the delimiters
|
inline |
split input string s by regular expression delimiter delimiter.
returns a vector of non-empty strings that are between the delimiters
|
inline |
Replaces occurrences of substring toReplace in string s with string replaceWith.
Modifies s in place.
1.8.13