code: public static Slice trim(Slice utf8)
      {
          int start = firstNonWhitespacePosition(utf8);
          int end = lastNonWhitespacePosition(utf8, start);
          return utf8.slice(start, end - start);
      }
docs: Removes all white space characters from the left and right side of the string.
  <p>
  Note: Invalid UTF-8 sequences are not trimmed.