StrFormatUtil { public static String parseCharset(String target){ Matcher matcher = charsetPattern.matcher(target); if (matcher.find()){ return matcher.group(1); } return ""; }  static String info(String pattern,Object... params); static String getFirstEmStr(List<Object> list,String def); static String parseCharset(String target); static String getHost(String url); static String getDodmain(String url);  }
@Test public void testParseCharset() throws Exception { String t = "text/html; charset=utf-16;text/html; charset=utf-8"; String r = StrFormatUtil.parseCharset(t); System.out.println(r); Assert.assertTrue("utf-8".equals(r)); }