Functions { public static String cut(String value, int length) { if (value == null || value.isEmpty()) { return ""; } StringBuilder sb = new StringBuilder(); for (int i = 0, l = value.length(); i < l; i++) { if (i >= length) { break; } sb.append(value.charAt(i)); } return sb.toString(); } private  Functions(); static String h(Object input); static String u(String value); static String br(String value); static String cut(String value, int length); static String link(String value); static String mapToQuery(Map<String, ?> map); @Deprecated static String mapToQuery(Map<String, ?> map,
            BeanWrapper beanWrapper); static String query(Object params); static String js(String value); static String hjs(String input);  }
@Test public void testCut() { assertThat(Functions.cut(null, 1), is("")); assertThat(Functions.cut("", 1), is("")); assertThat(Functions.cut("abcdef", 3), is("abc")); assertThat(Functions.cut("abcdef", 7), is("abcdef")); assertThat(Functions.cut("abcdef", 0), is("")); assertThat(Functions.cut("abcdef", -1), is("")); }