|
cprover
|
#include <iosfwd>#include <string>#include <vector>
Include dependency graph for string_utils.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Functions | |
| std::string | strip_string (const std::string &s) |
| Remove all whitespace characters from either end of a string. More... | |
| void | split_string (const std::string &s, char delim, std::vector< std::string > &result, bool strip=false, bool remove_empty=false) |
| Given a string s, split into a sequence of substrings when separated by specified delimiter. More... | |
| void | split_string (const std::string &s, char delim, std::string &left, std::string &right, bool strip=false) |
| std::vector< std::string > | split_string (const std::string &s, char delim, bool strip=false, bool remove_empty=false) |
| std::string | trim_from_last_delimiter (const std::string &s, const char delim) |
| template<typename Stream , typename It , typename Delimiter > | |
| Stream & | join_strings (Stream &os, const It b, const It e, const Delimiter &delimiter) |
| Prints items to an stream, separated by a constant delimiter. More... | |
| std::string | escape (const std::string &) |
| Generic escaping of strings; this is not meant to be a particular programming language. More... | |
| void | replace_all (std::string &, const std::string &, const std::string &) |
| Replace all occurrences of a string inside a string. More... | |
| std::string escape | ( | const std::string & | ) |
Generic escaping of strings; this is not meant to be a particular programming language.
Definition at line 148 of file string_utils.cpp.
| Stream& join_strings | ( | Stream & | os, |
| const It | b, | ||
| const It | e, | ||
| const Delimiter & | delimiter | ||
| ) |
Prints items to an stream, separated by a constant delimiter.
| It | An iterator type |
| Delimiter | A delimiter type which supports printing to ostreams |
| os | An ostream to write to |
| b | Iterator pointing to first item to print |
| e | Iterator pointing past last item to print |
| delimiter | Object to print between each item in the iterator range |
Definition at line 52 of file string_utils.h.
| void replace_all | ( | std::string & | str, |
| const std::string & | from, | ||
| const std::string & | to | ||
| ) |
Replace all occurrences of a string inside a string.
| [out] | str | string to search |
| from | string to replace | |
| to | string to replace with Copyright notice: Attributed to Gauthier Boaglio Source: https://stackoverflow.com/a/24315631/7501486 Used under MIT license |
Definition at line 171 of file string_utils.cpp.
| void split_string | ( | const std::string & | s, |
| char | delim, | ||
| std::vector< std::string > & | result, | ||
| bool | strip, | ||
| bool | remove_empty | ||
| ) |
Given a string s, split into a sequence of substrings when separated by specified delimiter.
| s | The string to split up | |
| delim | The character to use as the delimiter | |
| [out] | result | The sub strings. Must be empty. |
| strip | If true, strip_string will be used on each element, removing whitespace from the beginning and end of each element | |
| remove_empty | If true, all empty-string elements will be removed. This is applied after strip so whitespace only elements will be removed if both are set to true |
Definition at line 49 of file string_utils.cpp.
| void split_string | ( | const std::string & | s, |
| char | delim, | ||
| std::string & | left, | ||
| std::string & | right, | ||
| bool | strip = false |
||
| ) |
Definition at line 100 of file string_utils.cpp.
| std::vector<std::string> split_string | ( | const std::string & | s, |
| char | delim, | ||
| bool | strip = false, |
||
| bool | remove_empty = false |
||
| ) |
Definition at line 126 of file string_utils.cpp.
| std::string strip_string | ( | const std::string & | s | ) |
Remove all whitespace characters from either end of a string.
Whitespace in the middle of the string is left unchanged
| s | the string to strip |
Definition at line 21 of file string_utils.cpp.
| std::string trim_from_last_delimiter | ( | const std::string & | s, |
| const char | delim | ||
| ) |
Definition at line 137 of file string_utils.cpp.