public static String escape(CharSequence seq) {
    StringBuilder builder = new StringBuilder(seq.length() * 3 / 2);
    for (int i = 0; i < seq.length(); i++)
      builder.append(escape(seq.charAt(i)));
    return builder.toString();
  }
Returns the number of whitespace characters at the end of the given line.

@param line
@return
spock-core/src/main/java/org/spockframework/util/TextUtil.java