26#include <SimoxUtility/algorithm/string/string_tools.h>
28std::vector<std::string>
30 const std::string& splitBy,
32 bool removeEmptyElements)
34 return simox::alg::split(source, splitBy, trimElements, removeEmptyElements);
37std::vector<std::string>
39 const std::string& splitBy,
41 bool removeEmptyElements)
43 return armarx::Split(source, splitBy, trimElements, removeEmptyElements);
49 return simox::alg::starts_with(haystack, needle);
55 return simox::alg::ends_with(haystack, needle);
59armarx::Contains(
const std::string& haystack,
const std::string& needle,
bool caseInsensitive)
61 std::string haystackToSearch = (caseInsensitive) ? simox::alg::to_lower(haystack) : haystack;
62 std::string needleToSearchFor = (caseInsensitive) ? simox::alg::to_lower(needle) : needle;
64 return haystackToSearch.find(needleToSearchFor) != std::string::npos;
71 buffer.reserve(
data.size());
72 for (
size_t pos = 0; pos !=
data.size(); ++pos)
77 buffer.append(
"&");
80 buffer.append(
""");
83 buffer.append(
"'");
86 buffer.append(
"<");
89 buffer.append(
">");
92 buffer.append(&
data[pos], 1);
102 std::stringstream ss;
104 ss.imbue(std::locale::classic());
113 std::stringstream ss;
115 ss.imbue(std::locale::classic());
124 long long l = std::stoll(input,
nullptr, 0);
127 std::stringstream ss;
128 ss <<
"Could not parse " << input <<
" to unsigned int";
129 throw std::out_of_range(ss.str());
131 return static_cast<unsigned int>(l);
std::vector< std::string > split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)
bool ends_with(const std::string &haystack, const std::string &needle)
unsigned int toUInt(const std::string &input)
std::string Encode(const std::string &data)
std::vector< std::string > Split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)
bool Contains(const ContainerType &container, const ElementType &searchElement)
int toInt(const std::string &input)
bool starts_with(const std::string &haystack, const std::string &needle)
float toFloat(const std::string &input)
Converts a string to float and uses always dot as seperator.