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.

misc.c 331B

12345678910111213141516171819
  1. #include <stdbool.h>
  2. #include <unistd.h>
  3. #include <ctype.h>
  4. #include <stdlib.h>
  5. bool is_float(const char *string) {
  6. if (string == NULL) {
  7. return false;
  8. }
  9. char *endptr;
  10. strtod(string, &endptr);
  11. if (string == endptr) {
  12. return false;
  13. }
  14. while (isspace((unsigned char ) *endptr)) {
  15. endptr++;
  16. }
  17. return *endptr == '\0';
  18. }