| 393 | } |
| 394 | |
| 395 | SIValue SIValue_FromString(const char *s) { |
| 396 | char *sEnd = NULL; |
| 397 | |
| 398 | errno = 0; |
| 399 | double parsedval = strtod(s, &sEnd); |
| 400 | // the input was not a complete number or represented a number that |
| 401 | // cannot be represented as a double |
| 402 | // create a string SIValue |
| 403 | if(sEnd[0] != '\0' || errno == ERANGE) { |
| 404 | return SI_DuplicateStringVal(s); |
| 405 | } |
| 406 | |
| 407 | // The input was fully converted; create a double SIValue. |
| 408 | return SI_DoubleVal(parsedval); |
| 409 | } |
| 410 | |
| 411 | size_t SIValue_StringJoinLen(SIValue *strings, unsigned int string_count, const char *delimiter) { |
| 412 | size_t length = 0; |