|
cprover
|
#include "string_utils.h"#include "exception_utils.h"#include "invariant.h"#include <algorithm>#include <cassert>#include <cctype>#include <iomanip>
Include dependency graph for string_utils.cpp: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, bool remove_empty) |
| 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) |
| std::vector< std::string > | split_string (const std::string &s, char delim, bool strip, bool remove_empty) |
| std::string | trim_from_last_delimiter (const std::string &s, const char delim) |
| std::string | escape (const std::string &s) |
| Generic escaping of strings; this is not meant to be a particular programming language. More... | |
| std::string | escape_non_alnum (const std::string &to_escape) |
Replace non-alphanumeric characters with _xx escapes, where xx are hex digits. More... | |
| std::string escape | ( | const std::string & | s | ) |
Generic escaping of strings; this is not meant to be a particular programming language.
Definition at line 140 of file string_utils.cpp.
| std::string escape_non_alnum | ( | const std::string & | to_escape | ) |
Replace non-alphanumeric characters with _xx escapes, where xx are hex digits.
Underscores are replaced by __.
| to_escape | string to escape |
Definition at line 155 of file string_utils.cpp.
| std::vector<std::string> split_string | ( | const std::string & | s, |
| char | delim, | ||
| bool | strip, | ||
| bool | remove_empty | ||
| ) |
Definition at line 118 of file string_utils.cpp.
| void split_string | ( | const std::string & | s, |
| char | delim, | ||
| std::string & | left, | ||
| std::string & | right, | ||
| bool | strip | ||
| ) |
Definition at line 92 of file string_utils.cpp.
| 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.
| 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 40 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 22 of file string_utils.cpp.
| std::string trim_from_last_delimiter | ( | const std::string & | s, |
| const char | delim | ||
| ) |
Definition at line 129 of file string_utils.cpp.