Skip to content

Instantly share code, notes, and snippets.

@halyph
Created January 21, 2012 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halyph/1652981 to your computer and use it in GitHub Desktop.
Save halyph/1652981 to your computer and use it in GitHub Desktop.
Join String arguments into one String separated by comma (",")
/**
* Join String arguments into one String separated by comma (",")
* @param args input Strings
* @return joined String
*/
public static String join(String... args) {
if(args.length <1) throw new IllegalArgumentException();
String joined = Arrays.toString(args);
String result = joined.substring(1, joined.length()-1);
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment