StringUtils { public static String[] fromCsv(String string) { if (string == null) { return null; } else { char[] charArr = string.toCharArray(); int commaCount = 0; for (char c : charArr) { if (c == ',') { commaCount++; } } String[] escaped = new String[commaCount + 1]; int index = 0; int offset = 0; int count = 0; for (char c : charArr) { if (c == ',') { escaped[index ++] = new String(charArr, offset, count); offset += count + 1; count = 0; } else { count++; } } if (index == commaCount) { escaped[index] = new String(charArr, offset, count); } int length = escaped.length; List<String> unescaped = new ArrayList<String>(); for (int i = 0; i < length; i ++) { String value = escaped[i]; if (value.startsWith("\"")) { StringBuilder builder = new StringBuilder(); int quoteCount = 0; do { builder.append(value); for (char c : value.toCharArray()) { if (c == '"') { quoteCount++; } } if (quoteCount % 2 == 1) { value = escaped[++i]; builder.append(','); } } while (quoteCount % 2 == 1); value = builder.toString(); } unescaped.add(StringUtils.unescapeCsv(value)); } return unescaped.toArray(new String[unescaped.size()]); } }  @Deprecated static T fromString(Class<T> returnType, String... strings); static String toDelimited(String string, String delimiter); static String toHyphenated(String string); static String toUnderscored(String string); static String toPascalCase(String string); static String toCamelCase(String string); static String toLabel(String string); static String toNormalized(CharSequence string); static String[] fromCsv(String string); static String toCsv(String... strings); static String escapeHtmlAndBreak(String string, int maxWordLength); static String escapeHtmlAndBreak(String string); static String hex(byte[] bytes); static byte[] hash(String algorithm, String string); static byte[] md5(String string); static byte[] sha1(String string); static byte[] sha512(String string); static byte[] hmac(String algorithm, String key, String string); static byte[] hmacSha1(String key, String string); static String encodeUri(String string); static String decodeUri(String string); static String addQueryParameters(String uri, Object... parameters); static String getQueryParameterValue(String uri, String name); static List<String> getQueryParameterValues(String uri, String name); static Map<String, List<String>> getQueryParameterMap(String url); @Deprecated static String transformUri(String uri, Object... parameters); @Deprecated static String getParameter(String uri, String name); @Deprecated static String[] getParameterValues(String uri, String name); static Pattern getPattern(String pattern); static Matcher getMatcher(CharSequence string, String pattern); static MatchResult getMatcherResult(CharSequence string, String pattern); static boolean matches(CharSequence string, String pattern); static boolean matchAll(CharSequence string, String... patterns); static boolean matchAny(CharSequence string, String... patterns); static int matchCount(CharSequence string, String... patterns); static String replaceAll(CharSequence string, String pattern, String replacement); static String replaceAll(CharSequence string, String pattern, String replacement, String... more); static String removeAll(CharSequence string, CharSequence pattern); static String[] split(CharSequence string, String pattern, int limit); static String[] split(CharSequence string, String pattern); static String escapeCsv(String string); static String escapeHtml(String string); static String escapeJava(String string); static String escapeJavaScript(String string); static String escapeQuotes(String string); static String escapeSql(String string); static String escapeXml(String string); static String unescapeCsv(String string); static String unescapeHtml(String string); static String unescapeJava(String string); static String unescapeJavaScript(String string); static String unescapeXml(String string); static String join(List<String> strings, String delimiter); static String join(String[] strings, String delimiter); static boolean isEmpty(String string); static boolean isBlank(String string); static boolean equals(String str1, String str2); static boolean equalsIgnoreCase(String str1, String str2); static String stripHtml(CharSequence sequence); static String ensureStart(String string, String delimiter); static String ensureEnd(String string, String delimiter); static String ensureSurrounding(String string, String delimiter); static String removeStart(String string, String delimiter); static String removeEnd(String string, String delimiter); static String removeSurrounding(String string, String delimiter); static String getPathInfo(String path, String servletPath); static String toLowerCaseAscii(String string); static String trimAndCollapseWhitespaces(String string); static String getFileName(String filePath); @Deprecated
    static final Charset US_ASCII; @Deprecated
    static final Charset ISO_8859_1; @Deprecated
    static final Charset UTF_8; @Deprecated
    static final Charset UTF_16BE; @Deprecated
    static final Charset UTF_16LE; @Deprecated
    static final Charset UTF_16; }
@Test public void fromCsv_null() { assertArrayEquals(null, StringUtils.fromCsv(null)); }
@Test public void fromCsv() { assertArrayEquals(new String[]{"a","b"}, StringUtils.fromCsv("a,b")); }
@Ignore @Test public void fromCsv_quoted() { assertArrayEquals(new String[]{"a","b"}, StringUtils.fromCsv("\"a\",b")); }
@Ignore @Test public void fromCsv_quoted_multichar() { assertArrayEquals(new String[]{"abc","b"}, StringUtils.fromCsv("\"abc\",b")); }
@Test public void fromCsv_inline_quoted_quote() { assertArrayEquals(new String[]{"a\"","b"}, StringUtils.fromCsv("\"a\"\"\",b")); }
@Test public void fromCsv_space() { assertArrayEquals(new String[]{" a"," b "}, StringUtils.fromCsv(" a, b ")); }
@Test public void fromCsv_comma() { assertArrayEquals(new String[]{"a,b","c"}, StringUtils.fromCsv("\"a,b\",c")); }
@Test public void fromCsv_newline() { assertArrayEquals(new String[]{"a\nb","c"}, StringUtils.fromCsv("\"a\nb\",c")); }