Hi! Well, if you just want to print the string/variable, there's a special 'format' character %v that will do it for you (or %q to quote it).
jsiConsolePrintf("%v ", hc); // no need even for jsvAsString
Is that what you're after?
Otherwise if you need to get every character for use in your own code then JsvStringIterator is more sensible.
There is another option which is to use the macro JSV_GET_AS_CHAR_ARRAY which will try and get a pointer to the string, will allocate memory on the stack and give you a pointer, or will just fail.
Ideally don't use that for your own code, but it's useful if you're trying to use some other code which was designed just to work on a flat memory area
© Espruino, powered by microcosm.
Report a problem