#include <stdio.h>#include <stdlib.h>#include <ctype.h>#include <string.h>#include <math.h>#include "include/decpoint.h"Go to the source code of this file.
Functions | |
| int | dec_comma_is (char *str) |
| int | dec_separator (char *str) |
| void | dec_separator_change (char *str, int decsep) |
| double | atof_dpi (char *str) |
| int | dec_nr (char *str) |
| int | atof_with_check (char *double_as_string, double *result_value) |
| char * | strPtrToNextValue (char *str, char **nxtp) |
| double atof_dpi | ( | char * | str | ) |
Replacement of atof(), which works whether string contains decimal dots or decimal commas. Possible commas are replaced by dots in the argument string.
| str | Pointer to string (not modified). |
Definition at line 102 of file decpoint.c.
Referenced by atof_with_check().
| int atof_with_check | ( | char * | double_as_string, |
| double * | result_value | ||
| ) |
Converts a string to float using strtod(), but if its return value is zero this function checks that argument string actually contains a number.
| double_as_string | String which is converted to a double; not modified |
| result_value | Pointer to the double float |
Definition at line 147 of file decpoint.c.
References atof_dpi().
| int dec_comma_is | ( | char * | str | ) |
Checks whether argument string contains a decimal comma instead of dot.
| str | Pointer to string (not modified). |
Definition at line 57 of file decpoint.c.
| int dec_nr | ( | char * | str | ) |
Returns the number of decimal places in the argument string, representing a floating point value. String can contain either decimal dots or commas.
Definition at line 123 of file decpoint.c.
| int dec_separator | ( | char * | str | ) |
Checks whether argument string contains a decimal comma or dot, or neither.
| str | Pointer to string (not modified). |
Definition at line 71 of file decpoint.c.
| void dec_separator_change | ( | char * | str, |
| int | decsep | ||
| ) |
Convert the first decimal separator to comma or dot, as required.
| str | Pointer to string (modified when necessary). |
| decsep | Requested decimal separator: 0=dot, 1=comma. |
Definition at line 83 of file decpoint.c.
| char* strPtrToNextValue | ( | char * | str, |
| char ** | nxtp | ||
| ) |
This function searches the given string for a string representation of numerical value, possibly with decimal and exponent part. Returns also pointer to the string right after where the numerical value ended, and from where the next number can be searched. Return Returns pointer to start of the next string, or NULL if not found.
| str | Pointer to string where numerical values are searched; not changed. |
| nxtp | Obligatory pointer to string pointer, which will be set to point to the first character after value string, or to NULL if string ends. |
Definition at line 170 of file decpoint.c.
1.8.0