public static <T> String join(T[] array, String delimiter)
{
if (array.length == 0)
return "";
StringBuilder builder = new StringBuilder();
builder.append(array[0]);
for (int i = 1; i < array.length; i++)
builder.append(delimiter).append(array[i]);
return builder.toString();
}
Wednesday, October 28, 2009
My Favorite Join Function
My favorite implementation of a join function (in Java):
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment