public static string join(object array[], string separator)
{
if(array == null)
return null;
if(separator == null)
separator = "";
int arraysize = array.length;
int bufsize = arraysize != 0 ? arraysize * ((array[0] != null ? array[0].tostring().length() : 16) (separator == null ? 0 : separator.length())) : 0;
stringbuffer buf = new stringbuffer(bufsize);
for(int i = 0; i < arraysize; i )
{
if(separator != null && i > 0)
buf.append(separator);
if(array[i] != null)
buf.append(array[i]);
}
return buf.tostring();
}
posted on 2011-12-21 10:01
紫蝶∏飛揚↗ 阅读(759)
评论(0) 编辑 收藏 所属分类:
java