18 #define GETNAME(x) (#x)
22 bool is_hex(
const char *buf,
size_t len);
24 bool is_dec(
const char *buf,
size_t len);
28 size_t strip_to_list(IN std::string s, IN std::string delim, OUT std::set<std::string> &elements_list);
29 std::string&
trim(std::string& str,
const std::string& chars =
"\t\n\v\f\r ");
35 template <
typename T_CHAR>
38 if (str1 ==
nullptr)
return "";
41 for (
size_t i = 0; ; i++) {
42 if (str1[i] == 0)
break;
43 val.push_back((
char)str1[i]);
48 template <
typename T_CHAR>
49 int loadInt(
const T_CHAR *str1,
bool isHex =
false)
55 ss << std::hex << str;
58 ss << std::dec << str;
64 template <
typename T_CHAR>
76 if (!
is_dec(str.c_str(), str.length())) {
79 const int val =
loadInt(str.c_str(),
false);
92 template <
typename T_STR,
typename T_CHAR>
95 size_t val_len = value.length() + 1;
96 if (val_len > buf_count) {
99 memcpy(buf, value.c_str(), val_len *
sizeof(T_CHAR));
100 buf[val_len - 1] =
'\0';
bool strequals(const std::string &a, const std::string &b, bool ignoreCase=true)
bool loadBoolean(IN const T_CHAR *str1, OUT bool &value)
long get_number(const char *my_buf)
bool is_dec(const char *buf, size_t len)
void print_in_color(int color, const std::string &text)
bool is_number(const char *my_buf)
std::string to_string(T_CHAR *str1)
bool get_console_color(HANDLE hConsole, int &color)
size_t strip_to_list(IN std::string s, IN std::string delim, OUT std::set< std::string > &elements_list)
size_t copy_to_cstr(T_STR value, T_CHAR *buf, size_t buf_count)
Copy the std::string/std::wstring value into an buffer of a given character count.
bool is_hex(const char *buf, size_t len)
std::string & trim(std::string &str, const std::string &chars="\t\n\v\f\r ")
int loadInt(const T_CHAR *str1, bool isHex=false)
bool is_hex_with_prefix(const char *buf)
The set of utility functions related with string processing, and finding similarity between strings.