7#ifndef MYGUI_STRING_UTILITY_H_
8#define MYGUI_STRING_UTILITY_H_
20 _str.erase(
_str.find_last_not_of(
" \t\r") + 1);
22 _str.erase(0,
_str.find_first_not_of(
" \t\r"));
41 return std::string{
_value};
44 template<
typename...
Args>
55 return _value ?
"true" :
"false";
73 if (item !=
' ' && item !=
'\t')
134 template<
class ReturnType,
class InputType = ReturnType>
142 _ret.emplace_back(
_source.substr(start, end - start));
155 std::vector<std::string>
result;
160 template<
typename...
Args>
175 if (item !=
' ' && item !=
'\t')
186 std::string value(
_value);
188 if ((value ==
"True") || (value ==
"true") || (value ==
"1"))
193 if ((value ==
"False") || (value ==
"false") || (value ==
"0"))
204#if __cplusplus >= 202002L
207 size_t count =
_value.size();
210 for (
size_t index = 0; index < count; ++index)
221#if __cplusplus >= 202002L
224 size_t count =
_value.size();
227 size_t offset =
_source.size() - count;
228 for (
size_t index = 0; index < count; ++index)
void split(std::vector< ReturnType > &_ret, const InputType &_source, const InputType &_delims)
unsigned int parseUInt(std::string_view _value)
bool endWith(std::string_view _source, std::string_view _value)
bool parseBool(std::string_view _value)
float parseFloat(std::string_view _value)
size_t parseSizeT(std::string_view _value)
std::vector< std::string > split(std::string_view _source, std::string_view _delims="\t\n ")
std::string toString(T _value)
std::string toString< bool >(bool _value)
bool parseComplex< bool >(std::string_view _value, bool &arg)
T parseValue(std::string_view _value)
bool startWith(std::string_view _source, std::string_view _value)
bool parseComplex(std::string_view _value, Args &... args)
int parseInt(std::string_view _value)
double parseDouble(std::string_view _value)
void trim(std::string &_str, bool _left=true, bool _right=true)