index-n-string

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

We output the character by index from the string in the form "NUMBER".
index-n-string
@/index-n-string
We output the character by index from the string in the form "NUMBER".
STRstring
IDXnumber
index-n-string
STR
IDX
CHAR
CHARnumber
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);
}