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);