return TRUE;
}
+bool str_is_float(const char *str, char end_char)
+{
+ bool dot_seen = FALSE;
+ bool num_seen = FALSE;
+
+ if (*str == '\0' || *str == end_char)
+ return FALSE;
+
+ while (*str != '\0' && *str != end_char) {
+ if (*str == '.') {
+ if (dot_seen || !num_seen) return FALSE;
+ dot_seen = TRUE;
+ num_seen = FALSE;
+ str++;
+ /* enforce that number follows dot */
+ continue;
+ }
+ if (*str < '0' || *str > '9')
+ return FALSE;
+ num_seen = TRUE;
+ str++;
+ }
+
+ return num_seen;
+}
+
/*
* Unsigned decimal
*/
Stop when `end_char' is found from string. */
bool str_is_numeric(const char *str, char end_char) ATTR_PURE;
+/* Return TRUE when string has one or more numbers, followed
+ with zero or one dot, followed with at least one number. */
+bool str_is_float(const char *str, char end_char) ATTR_PURE;
+
/* Returns human readable string about what is wrong with the string.
This function assumes that str_to_*() had already returned -1 for the
string. */