class StringUtil {

    @NonNull public static CharSequence strip(@Nullable CharSequence str) {
        if (str == null || str.length() == 0) {
            return "";
        }
        int len = str.length();
        int start = 0;
        int end = len - 1;
        while (start < len && Character.isWhitespace(str.charAt(start))) {
            start++;
        }
        while (end > 0 && Character.isWhitespace(str.charAt(end))) {
            end--;
        }
        if (end > start) {
            return str.subSequence(start, end + 1);
        }
        return "";
    }

    private  StringUtil();

}