@Test public void substringBefore() throws Exception { assertEquals("text/html", StringUtil.substringBefore("text/html; charset=utf-8", ';')); assertEquals("", StringUtil.substringBefore(";charset=utf-8", ';')); assertEquals("text/html", StringUtil.substringBefore("text/html", ';')); }
public static String substringBefore(String value, char delim) { if (value == null) { return null; } int pos = value.indexOf(delim); if (pos >= 0) { return value.substring(0, pos); } return value; }
StringUtil { public static String substringBefore(String value, char delim) { if (value == null) { return null; } int pos = value.indexOf(delim); if (pos >= 0) { return value.substring(0, pos); } return value; } }
StringUtil { public static String substringBefore(String value, char delim) { if (value == null) { return null; } int pos = value.indexOf(delim); if (pos >= 0) { return value.substring(0, pos); } return value; }  }
StringUtil { public static String substringBefore(String value, char delim) { if (value == null) { return null; } int pos = value.indexOf(delim); if (pos >= 0) { return value.substring(0, pos); } return value; }  static String substringBefore(String value, char delim); static String substringAfter(String value, char delim, boolean stripQuoteMarks); }
StringUtil { public static String substringBefore(String value, char delim) { if (value == null) { return null; } int pos = value.indexOf(delim); if (pos >= 0) { return value.substring(0, pos); } return value; }  static String substringBefore(String value, char delim); static String substringAfter(String value, char delim, boolean stripQuoteMarks);  }