// returns l(s) if not found static int smartIndexOf(S s, S sub, int i) { if (s == null) ret 0; i = s.indexOf(sub, min(i, l(s))); ret i >= 0 ? i : l(s); } static int smartIndexOf(S s, int i, char c) { ret smartIndexOf(s, c, i); } static int smartIndexOf(S s, char c, int i) { if (s == null) ret 0; i = s.indexOf(c, min(i, l(s))); ret i >= 0 ? i : l(s); } static int smartIndexOf(S s, S sub) { ret smartIndexOf(s, sub, 0); } static int smartIndexOf(S s, char c) { ret smartIndexOf(s, c, 0); } static int smartIndexOf(L l, A sub) { ret smartIndexOf(l, sub, 0); } static int smartIndexOf(L l, int start, A sub) { ret smartIndexOf(l, sub, start); } static int smartIndexOf(L l, A sub, int start) { int i = indexOf(l, sub, start); ret i < 0 ? l(l) : i; }