feat: String_ToFloat + Json escape sequence support
- Add bux_str_to_float() C runtime wrapper (strtod) - Add String_ToFloat() in library/std/String.bux - Update JsonParser_ParseNumber to use String_ToFloat (decimals now work) - Update JsonParser_ParseString to decode escape sequences (\n, \t, \r, \", \\, \b, \f) - Fix use-after-free in JsonParser_ParseString: String_Copy before StringBuilder_Free
This commit is contained in:
@@ -221,6 +221,11 @@ char* bux_strncpy(char* dest, const char* src, unsigned int n) {
|
||||
return strncpy(dest, src, (size_t)n);
|
||||
}
|
||||
|
||||
double bux_str_to_float(const char* s) {
|
||||
if (!s) return 0.0;
|
||||
return strtod(s, NULL);
|
||||
}
|
||||
|
||||
/* String find: returns pointer to first occurrence of needle in haystack, or NULL */
|
||||
const char* bux_strstr(const char* haystack, const char* needle) {
|
||||
if (!haystack || !needle) return NULL;
|
||||
|
||||
Reference in New Issue
Block a user