static int indexOfSpaceEtc(S s) {
  int n = l(s);
  for i to n:
    if (isSpace(s.charAt(i)))
      ret i;
  ret -1;
}