sS replace_multi(S s, Cl a, S b) { if (s == null || empty(a) || b == null) ret s; for (S aa : a) s = s.replace(aa, b); ret s; } // replacements = in, out, in, out, ... sS replace_multi(S s, S... replacements) { if (empty(s) || empty(replacements)) ret s; for (int i = 0; i+1 < l(replacements); i += 2) s = s.replace(replacements[i], replacements[i+1]); ret s; }