Go to the documentation of this file.
26 #include <SimoxUtility/algorithm/string/string_tools.h>
29 std::vector<std::string>
armarx::Split(
const std::string&
source,
const std::string& splitBy,
bool trimElements,
bool removeEmptyElements)
35 std::vector<std::string>
36 armarx::split(
const std::string&
source,
const std::string& splitBy,
bool trimElements,
bool removeEmptyElements)
56 bool armarx::Contains(
const std::string& haystack,
const std::string& needle,
bool caseInsensitive)
58 std::string haystackToSearch = (caseInsensitive) ? simox::alg::to_lower(haystack) : haystack;
59 std::string needleToSearchFor = (caseInsensitive) ? simox::alg::to_lower(needle) : needle;
61 return haystackToSearch.find(needleToSearchFor) != std::string::npos;
68 buffer.reserve(
data.size());
69 for (
size_t pos = 0; pos !=
data.size(); ++pos)
74 buffer.append(
"&");
77 buffer.append(
""");
80 buffer.append(
"'");
83 buffer.append(
"<");
86 buffer.append(
">");
89 buffer.append(&
data[pos], 1);
101 ss.imbue(std::locale::classic());
110 std::stringstream ss;
112 ss.imbue(std::locale::classic());
120 long long l = std::stoll(
input,
nullptr, 0);
122 std::stringstream ss;
123 ss <<
"Could not parse " <<
input <<
" to unsigned int";
124 throw std::out_of_range(ss.str());
126 return static_cast<unsigned int>(l);
unsigned int toUInt(const std::string &input)
int toInt(const std::string &input)
bool Contains(const ContainerType &container, const ElementType &searchElement)
std::vector< std::string > Split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)
float toFloat(const std::string &input)
Converts a string to float and uses always dot as seperator.
std::string Encode(const std::string &data)
bool starts_with(const std::string &haystack, const std::string &needle)
ReaderT::InputType & input
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
bool ends_with(const std::string &haystack, const std::string &needle)
std::vector< std::string > split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)