index-string

nazarijtipusak080/accumulate-and-read-character-string/index-string

We output the character by index from the string in the form "byte".
index-string
@/index-string
We output the character by index from the string in the form "byte".
STRstring
IDXnumber
index-string
STR
IDX
CHAR
CHARbyte
To use the node in your project you should have the nazarijtipusak080/accumulate-and-read-character-string library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    auto str = getValue<input_STR>(ctx);
    auto idx = getValue<input_IDX>(ctx);
    int i = 0;
    for (auto it = str->iterate(); it; ++it) {
        if (i == idx) {
           emitValue<output_CHAR>(ctx,(char)*it);
           return;
        }
        i++;
    }
    emitValue<output_CHAR>(ctx,0);
}