A Gtk3 app that added 10% tax to a price
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
331 B

4 years ago
#include <stdbool.h>
#include <unistd.h>
#include <ctype.h>
#include <stdlib.h>
bool is_float(const char *string) {
if (string == NULL) {
4 years ago
return false;
}
char *endptr;
strtod(string, &endptr);
if (string == endptr) {
4 years ago
return false;
}
while (isspace((unsigned char ) *endptr)) {
endptr++;
}
return *endptr == '\0';
}