Created
January 21, 2012 14:52
-
-
Save halyph/1652981 to your computer and use it in GitHub Desktop.
Join String arguments into one String separated by comma (",")
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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