• @Gordon nice, jsiConsolePrintf("%v ", hc); can print the JsVar's full string, but i still can't get the full string for variable defined in c code :( , it seems like the function jsvAsString() only get 20 length

    JsVar *hc = jsvNewFromString('dsafsafsafdsafdsafdsaf­dsafdsfdsafsafsafdsfsafsafsafdsaf');
    char *myStr = jsvAsString(hc);
    while(*myStr ){
    ...
    myStr ++;
    }
    
  • it seems like the function jsvAsString() only get 20 length

    maybe it was not clear from previous explanations - the string is not truncated, it is simply not stored in single piece anywhere in memory so to make it as single piece for you it must be created anew - on stack (or elsewhere) taking extra memory. So using iterator is definitely better if you iterate over it anyway, otherwise with larger strings you may overflow the stack

About

Avatar for fanoush @fanoush started