Issue #136 - trailing whitespace in string->number

Allow trailing whitespace, which allows us to accept a wider range of input.
This commit is contained in:
Justin Ethier 2016-11-17 23:19:13 +00:00
parent a898c99c9e
commit 3ab8ec401f

View file

@ -1719,7 +1719,7 @@ object Cyc_string2number_(void *data, object cont, object str)
} else { } else {
char *str_end; char *str_end;
n = strtold(s, &str_end); n = strtold(s, &str_end);
if (s != str_end && *str_end == '\0') { if (s != str_end && (*str_end == '\0' || isspace(*str_end))) {
make_double(result, n); make_double(result, n);
_return_closcall1(data, cont, &result); _return_closcall1(data, cont, &result);
} else { } else {