7#ifndef MYGUI_STRING_UTILITY_H_
8#define MYGUI_STRING_UTILITY_H_
31 MYGUI_EXPORT void trim(std::string& _str,
bool _left =
true,
bool _right =
true);
36 std::ostringstream stream;
49 inline std::string
toString(std::string_view _value)
51 return std::string{_value};
54 template<
typename... Args>
57 std::ostringstream stream;
58 ((stream << args), ...);
65 return _value ?
"true" :
"false";
72 std::stringstream stream(std::string{value});
101 return _value ==
"True" || _value ==
"true" || _value ==
"1";
126 MYGUI_EXPORT std::vector<std::string>
split(std::string_view _source, std::string_view _delims =
"\t\n ");
128 template<
typename... Args>
131 std::stringstream stream(std::string{_value});
133 ((stream >> args), ...);
139 int item = stream.get();
142 if (item !=
' ' && item !=
'\t')
153 std::string value(_value);
155 if ((value ==
"True") || (value ==
"true") || (value ==
"1"))
160 if ((value ==
"False") || (value ==
"false") || (value ==
"0"))
unsigned int parseUInt(std::string_view _value)
template MYGUI_EXPORT int parseValue< int >(std::string_view)
bool endWith(std::string_view _source, std::string_view _value)
bool parseBool(std::string_view _value)
float parseFloat(std::string_view _value)
T parseValue(std::string_view value)
size_t parseSizeT(std::string_view _value)
template MYGUI_EXPORT std::string toString< int >(int)
__attribute__((visibility("default"))) void trim(std std::string toString(T _value)
template MYGUI_EXPORT std::string toString< size_t >(size_t)
template MYGUI_EXPORT float parseValue< float >(std::string_view)
void trim(std::string &_str, bool _left, bool _right)
__attribute__((visibility("default"))) int parseInt(std __attribute__((visibility("default"))) unsigned int parseUInt(std __attribute__((visibility("default"))) size_t parseSizeT(std __attribute__((visibility("default"))) float parseFloat(std __attribute__((visibility("default"))) double parseDouble(std __attribute__((visibility("default"))) bool parseBool(std __attribute__((visibility("default"))) std bool parseComplex(std::string_view _value, Args &... args)
template MYGUI_EXPORT size_t parseValue< size_t >(std::string_view)
template MYGUI_EXPORT std::string toString< float >(float)
bool startWith(std::string_view _source, std::string_view _value)
std::vector< std::string > split(std::string_view _source, std::string_view _delims)
int parseInt(std::string_view _value)
double parseDouble(std::string_view _value)