I am needing a way to compare two strings and output a boolean if they are the same. I’ve looked through several times and just don’t see a way to do so. Is there a node I’m missing or perhaps a combination of nodes I just haven’t thought of?
Made a node for you: https://xod.io/libs/nkrkv/my-utils/string-equal/
Install the nkrkv/my-utils
lib and use it directly, or steal its implementation, it is quite simple:
struct State {
};
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
auto s1 = getValue<input_IN1>(ctx);
auto s2 = getValue<input_IN2>(ctx);
auto it1 = s1.iterate();
auto it2 = s2.iterate();
while (it1 && it2 && *it1 == *it2) {
++it1;
++it2;
}
bool comparisonPastTheEnd = !it1 && !it2;
emitValue<output_OUT>(ctx, comparisonPastTheEnd);
}
1 Like
Awesome, Thanks a lot