Skip to content

Commit

Permalink
Improved range function
Browse files Browse the repository at this point in the history
  • Loading branch information
dukky committed Sep 21, 2013
1 parent de00a86 commit 7e1eb9c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/main/java/VerbalExpression.java
Expand Up @@ -132,13 +132,11 @@ public VerbalExpression any(String value) {
return this;
}

public VerbalExpression range(Object[] args) {
public VerbalExpression range(String... args) {
String value = "[";
for(int _from = 0; _from < args.length; _from += 2) {
int _to = _from+1;
if (args.length <= _to) break;
int from = Integer.getInteger(sanitize((String)args[_from]));
int to = Integer.getInteger(sanitize((String)args[_to]));
for (int _to = 1; _to < args.length; _to += 2) {
String from = sanitize((String)args[_to - 1]);
String to = sanitize((String)args[_to]);

value += from + "-" + to;
}
Expand Down

0 comments on commit 7e1eb9c

Please sign in to comment.