// pred: char -> bool static S takeCharsWhile(S s, O pred) { int i = 0; while (i < l(s) && isTrue(callF(pred, s.charAt(i)))) ++i; ret substring(s, 0, i); }