String runString(CppiaCtx *ctx) { String val = strVal->runString(ctx); BCR_CHECK; int start = a0->runInt(ctx); BCR_CHECK; Dynamic end = a1->runObject(ctx); BCR_CHECK; if (SUBSTR) return val.substr(start,end); else return val.substring(start,end); }
int runInt(CppiaCtx *ctx) { String val = strVal->runString(ctx); BCR_CHECK; String s = sought->runString(ctx); BCR_CHECK; hx::Object *first = start->runObject(ctx); BCR_CHECK; if (LAST) return val.lastIndexOf(s,first); else return val.indexOf(s,first); }