Char as a decimal separator in C
问题 I've written a function that extracts double from a string. Like asfas123123afaf to 123123 or afafas12312.23131asfa to 12312.23131 using the point as a decimal separator. Here is the code: double get_double(const char *str, char sep) { char str_dbl[80]; size_t i,j; char minus; double dbl; for (minus = 1, i = j = 0; i < strlen(str); ++i) { if ( (str[i] == '-' && minus) || (str[i] >= '0' && str[i] <= '9') || (str[i] == 'e' || str[i] == 'E') ) { str_dbl[j++] = str[i]; minus = 0; } } str_dbl[j] =