@Test public void testArrayToString() { assertEquals(null, StringUtils.arrayToString(null , null)); assertEquals(null, StringUtils.arrayToString(null , "/")); assertEquals(null, StringUtils.arrayToString(new String[]{} , "")); assertEquals("test", StringUtils.arrayToString(new String[]{"test"} , "|")); assertEquals("12312.3", StringUtils.arrayToString(new Number[]{Integer.valueOf("123"), Double.valueOf("12.3")} , "")); assertEquals("firstsecondthird", StringUtils.arrayToString(new String[]{"first", "second", "third"} , null)); assertEquals(" first \t second \t third ", StringUtils.arrayToString(new String[]{" first ", " second ", " third "} , "\t")); assertEquals("null/null", StringUtils.arrayToString(new String[]{null, null} , "/")); assertEquals("null", StringUtils.arrayToString(new String[]{null} , "/")); }
public static String arrayToString(Object[] array, String separator) { if (array == null || array.length < 1) return null; if (array.length > 1) { StringBuilder buf = new StringBuilder(); for (int i = 0; i < array.length; i++) { if (i>0 && separator!=null) buf.append(separator); buf.append(array[i]); } return buf.toString(); } return String.valueOf(array[0]); }
StringUtils { public static String arrayToString(Object[] array, String separator) { if (array == null || array.length < 1) return null; if (array.length > 1) { StringBuilder buf = new StringBuilder(); for (int i = 0; i < array.length; i++) { if (i>0 && separator!=null) buf.append(separator); buf.append(array[i]); } return buf.toString(); } return String.valueOf(array[0]); } }
StringUtils { public static String arrayToString(Object[] array, String separator) { if (array == null || array.length < 1) return null; if (array.length > 1) { StringBuilder buf = new StringBuilder(); for (int i = 0; i < array.length; i++) { if (i>0 && separator!=null) buf.append(separator); buf.append(array[i]); } return buf.toString(); } return String.valueOf(array[0]); } private  StringUtils(); }
StringUtils { public static String arrayToString(Object[] array, String separator) { if (array == null || array.length < 1) return null; if (array.length > 1) { StringBuilder buf = new StringBuilder(); for (int i = 0; i < array.length; i++) { if (i>0 && separator!=null) buf.append(separator); buf.append(array[i]); } return buf.toString(); } return String.valueOf(array[0]); } private  StringUtils(); static String toString(Object value, String defValue); static String toString(Object value); static String toString(Object[] array, String defValue); static String toString(Object[] array); static String valueOf(Object value); static String valueOf(Object[] array); static String coalesce(String preferred, String alternative); static String nullIfEmpty(Object value); static boolean contains(String value, String substring); static boolean notContains(String value, String substring); static String arrayToString(Object[] array, String separator); static boolean isEmpty(String s); static boolean isNotEmpty(String s); static boolean compareEqual(String s1, String s2, boolean ignoreCase); static boolean compareEqual(String s1, String s2); static boolean compareNotEqual(String s1, String s2, boolean ignoreCase); static boolean compareNotEqual(String s1, String s2); static String validate(String s); static String replace(String source, String find, String replace); static String replaceAll(String s, String find, String replace); static String remove(String s, String remove); static String remove(String s, char c); static String removeBlanks(String s); static boolean isCharBetween(char c, char beg, char end); static boolean isNumber(char c); static boolean isNumber(String s); static boolean isNumeric(char c, boolean decimal); static boolean isNumeric(String s, boolean decimal); static boolean isUpper(char c); static boolean isUpper(String s, int count); static boolean isLower(char c); static boolean isLower(String s, int count); static String toUpper(String s, int count); static String toLower(String s, int count); }
StringUtils { public static String arrayToString(Object[] array, String separator) { if (array == null || array.length < 1) return null; if (array.length > 1) { StringBuilder buf = new StringBuilder(); for (int i = 0; i < array.length; i++) { if (i>0 && separator!=null) buf.append(separator); buf.append(array[i]); } return buf.toString(); } return String.valueOf(array[0]); } private  StringUtils(); static String toString(Object value, String defValue); static String toString(Object value); static String toString(Object[] array, String defValue); static String toString(Object[] array); static String valueOf(Object value); static String valueOf(Object[] array); static String coalesce(String preferred, String alternative); static String nullIfEmpty(Object value); static boolean contains(String value, String substring); static boolean notContains(String value, String substring); static String arrayToString(Object[] array, String separator); static boolean isEmpty(String s); static boolean isNotEmpty(String s); static boolean compareEqual(String s1, String s2, boolean ignoreCase); static boolean compareEqual(String s1, String s2); static boolean compareNotEqual(String s1, String s2, boolean ignoreCase); static boolean compareNotEqual(String s1, String s2); static String validate(String s); static String replace(String source, String find, String replace); static String replaceAll(String s, String find, String replace); static String remove(String s, String remove); static String remove(String s, char c); static String removeBlanks(String s); static boolean isCharBetween(char c, char beg, char end); static boolean isNumber(char c); static boolean isNumber(String s); static boolean isNumeric(char c, boolean decimal); static boolean isNumeric(String s, boolean decimal); static boolean isUpper(char c); static boolean isUpper(String s, int count); static boolean isLower(char c); static boolean isLower(String s, int count); static String toUpper(String s, int count); static String toLower(String s, int count);  }