Skip to content

Instantly share code, notes, and snippets.

@9SQ
Last active August 29, 2015 14:05
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 9SQ/9a0b8d5354c2cd5d6e32 to your computer and use it in GitHub Desktop.
Save 9SQ/9a0b8d5354c2cd5d6e32 to your computer and use it in GitHub Desktop.
カンマ区切りで渡された引数を配列に
public class Csv2array {
public static void main(String[] args) {
if (args.length < 1) {
System.out.println("Usage: java -jar Csv2array.jar [username(comma separated username)]");
System.exit(-1);
}
String[] split = args[0].split(",");
String[] usernameArray = new String[split.length];
for (int i = 0; i < usernameArray.length; i++) {
usernameArray[i] = split[i];
}
/* ここでusernameArrayを使った処理 */
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment