@Test public void testjoinString() { String[] arr = new String[]{"MySQL", "ORACLE", "MSSQL", "NOSQL"}; assertEquals("MySQL/ORACLE/MSSQL/NOSQL", StringUtil.joinString(arr, "/")); List<String> list = StringUtil.parseString2List(StringUtil.joinString(arr, "/"), "/"); assertEquals("MySQL:ORACLE:MSSQL:NOSQL", StringUtil.joinString(list, ":")); System.out.println(StringUtil.join("/")); System.out.println(StringUtil.join("/", "MySQL", "ORACLE", "MSSQL", "NOSQL")); }
public static String joinString(List list, String symbol) { String result = ""; if (list != null) { for (Object o : list) { String temp = o.toString(); if (temp.trim().length() > 0) result += (temp + symbol); } if (result.length() > 1) { result = result.substring(0, result.length() - 1); } } return result; }
StringUtil { public static String joinString(List list, String symbol) { String result = ""; if (list != null) { for (Object o : list) { String temp = o.toString(); if (temp.trim().length() > 0) result += (temp + symbol); } if (result.length() > 1) { result = result.substring(0, result.length() - 1); } } return result; } }
StringUtil { public static String joinString(List list, String symbol) { String result = ""; if (list != null) { for (Object o : list) { String temp = o.toString(); if (temp.trim().length() > 0) result += (temp + symbol); } if (result.length() > 1) { result = result.substring(0, result.length() - 1); } } return result; }  }
StringUtil { public static String joinString(List list, String symbol) { String result = ""; if (list != null) { for (Object o : list) { String temp = o.toString(); if (temp.trim().length() > 0) result += (temp + symbol); } if (result.length() > 1) { result = result.substring(0, result.length() - 1); } } return result; }  static boolean isEmpty(String str); static String joinString(List list, String symbol); static boolean requals(String str1, String str2); static boolean requals(String str1, String str2, String split); static String subStringOmit(String subject, int size); static String subStringSymbol(String str, int len, String symbol); static String joinString(String[] array, String symbol); static String join(String linkStr, String... strs); static String getHideEmailPrefix(String email); static String repeat(String src, int num); static String ltrim(String str1, int num); static String rtrim(String str, int num); static List<String> parseString2List(String src, String pattern); static String formatDouble(double f, String format); static String left(String input, int count); static String right(String input, int count); static String full2Half(String str); static String Half2Full(String str); static String replaceBlank(String str); static boolean isIn(String substring, String[] source); static String string2Unicode(String string); static String unicode2String(String unicode); static String trimPunct(String str); static double SimilarityRatio(String str1, String str2); static double SimilarDegree(String str1, String str2); static int countSubStr(String string, String str); static String replaceFirst(String s, String sub, String with); static String replaceLast(String s, String sub, String with); static String remove(String s, String sub); static String upperFirstChar(String str); static String lowerFirstChar(String str); static boolean rigthEquals(String str1, String str2, int length); static boolean leftEquals(String str1, String str2, int length); }
StringUtil { public static String joinString(List list, String symbol) { String result = ""; if (list != null) { for (Object o : list) { String temp = o.toString(); if (temp.trim().length() > 0) result += (temp + symbol); } if (result.length() > 1) { result = result.substring(0, result.length() - 1); } } return result; }  static boolean isEmpty(String str); static String joinString(List list, String symbol); static boolean requals(String str1, String str2); static boolean requals(String str1, String str2, String split); static String subStringOmit(String subject, int size); static String subStringSymbol(String str, int len, String symbol); static String joinString(String[] array, String symbol); static String join(String linkStr, String... strs); static String getHideEmailPrefix(String email); static String repeat(String src, int num); static String ltrim(String str1, int num); static String rtrim(String str, int num); static List<String> parseString2List(String src, String pattern); static String formatDouble(double f, String format); static String left(String input, int count); static String right(String input, int count); static String full2Half(String str); static String Half2Full(String str); static String replaceBlank(String str); static boolean isIn(String substring, String[] source); static String string2Unicode(String string); static String unicode2String(String unicode); static String trimPunct(String str); static double SimilarityRatio(String str1, String str2); static double SimilarDegree(String str1, String str2); static int countSubStr(String string, String str); static String replaceFirst(String s, String sub, String with); static String replaceLast(String s, String sub, String with); static String remove(String s, String sub); static String upperFirstChar(String str); static String lowerFirstChar(String str); static boolean rigthEquals(String str1, String str2, int length); static boolean leftEquals(String str1, String str2, int length);  }