47 inline T stringToNumber(
char *text) {
49 if (sscanf(text,
"%d", &res) > 0)
50 return static_cast<T
>(res);
55 inline float stringToNumber<float>(
char *text) {
57 if (sscanf(text,
"%f", &res) > 0)
63 inline double stringToNumber<double>(
char *text) {
65 if (sscanf(text,
"%lf", &res) > 0)
72 return stringToNumber<T>(
const_cast<char *
>(text.c_str()));
79 v._x = stringToNumber<int>(coords.
substr(0, comma));
80 v._y = stringToNumber<int>(coords.
substr(comma + 1));
85 #endif // CRAB_NUMSTR_H
static String format(MSVC_PRINTF const char *fmt,...) GCC_PRINTF(1
size_t findFirstOf(value_type c, size_t pos=0) const
String substr(size_t pos=0, size_t len=npos) const
Definition: moveeffect.h:37