gz-cpp-util 1.3
A c++20 library containing various utilities
|
Contains utility for strings. More...
#include <string>
#include <vector>
#include <unordered_map>
#include <map>
Go to the source code of this file.
Classes | |
struct | gz::util::string_hash |
Typedefs | |
Map with string type as key, works with strings, string_view and char* | |
template<typename T > | |
using | gz::util::unordered_string_map = std::unordered_map< std::string, T, util::string_hash, std::equal_to<> > |
A unordered_map where you can use string_views to access elements. More... | |
template<typename T > | |
using | gz::util::string_map = std::map< std::string, T, util::string_hash, std::equal_to<> > |
same as unordered_string_map, but using std::map instead of std::unordered_map | |
Functions | |
template<SplitStringInVectorImplemented T> | |
std::vector< T > | gz::util::splitStringInVector (const std::string_view &s, const std::string &separator, bool skipEmptyStrings=false) |
Split a string at a separator into a vector. More... | |
Contains utility for strings.
using gz::util::unordered_string_map = typedef std::unordered_map<std::string, T, util::string_hash, std::equal_to<> > |
A unordered_map where you can use string_views to access elements.
To retrieve an element using a string view, you need to do this:
The at() member and [] operator do not work with the string_view.
std::vector< T > gz::util::splitStringInVector | ( | const std::string_view & | s, |
const std::string & | separator, | ||
bool | skipEmptyStrings = false |
||
) |
Split a string at a separator into a vector.
Splits a string at a separator.
Two templates exist, one where the vector will hold std::string_views into s and one where it will hold std::strings. Behavior: