sS trim(S s) { if (s == null) null; int i = 0, n = s.length(), j = n; while (i < n && " \t\r\n".indexOf(s.charAt(i)) >= 0) ++i; while (j > i && " \t\r\n".indexOf(s.charAt(j-1)) >= 0) --j; ret substring(s, i, j); }