Skip to content

Commit

Permalink
splitting and trimming for list parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
TKlerx committed Apr 8, 2015
1 parent f700d5a commit 2f76521
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/beust/jcommander/JCommander.java
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ private String[] expandArgs(String[] originalArgv) {
if (isOption(v1, arg2)) {
String sep = getSeparatorFor(v1, arg2);
if (" ".equals(sep)) {
String[] sp = arg2.split("[" + sep + "]", 2);
String[] sp = arg2.split("[" + sep + "]+",2);
for (String ssp : sp) {
splitFileArgs.add(ssp);
}
Expand All @@ -388,7 +388,7 @@ private String[] expandArgs(String[] originalArgv) {
if (isOption(v1, arg)) {
String sep = getSeparatorFor(v1, arg);
if (! " ".equals(sep)) {
String[] sp = arg.split("[" + sep + "]", 2);
String[] sp = arg.split("[" + sep + "]+", 2);
for (String ssp : sp) {
vResult2.add(ssp);
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/beust/jcommander/args/ArgsList.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public List<String> convert(String value) {
public static class SemiColonSplitter implements IParameterSplitter {

public List<String> split(String value) {
return Arrays.asList(value.split(";"));
return Arrays.asList(value.split("\\s*;\\s*"));
}

}
Expand Down

0 comments on commit 2f76521

Please sign in to comment.