You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
should scan string of up to 30 characers from set [0-9a-zA-Z ] = both cases of alphanumeric characters and space. But it does not work in frozen.
Have you considered implementing this useful feature of scanf() to json_scanf()?
Also it would be nice to have some way to get pointer and length of escaped JSON string. sometimes there's no need to unescape so i would love to have way to parse string without using dynamic memory allocation, so it's faster and i don't have to free() anything...
i've used %.*s because that's how printf() handles situation where you want to pass string length along with pointer... But maybe %S would be nice option as well. in such case json_scanf() should return whole length of string minus the quotes (but still json escaped).
The text was updated successfully, but these errors were encountered:
Hello,
i've found that unlike original scanf(), the json_scanf() does not support "scanset" feature. Eg.:
json_scanf(in, sizeof(in), "{ str:%30[0-9a-zA-Z ] }", out);
should scan string of up to 30 characers from set [0-9a-zA-Z ] = both cases of alphanumeric characters and space. But it does not work in frozen.
Have you considered implementing this useful feature of scanf() to json_scanf()?
Also it would be nice to have some way to get pointer and length of escaped JSON string. sometimes there's no need to unescape so i would love to have way to parse string without using dynamic memory allocation, so it's faster and i don't have to free() anything...
Something like this would be great:
json_scanf(in, sizeof(in), "{ str:%.*s }", out.len, out.ptr);
i've used
%.*s
because that's how printf() handles situation where you want to pass string length along with pointer... But maybe%S
would be nice option as well. in such case json_scanf() should return whole length of string minus the quotes (but still json escaped).The text was updated successfully, but these errors were encountered: