Skip to content

Commit

Permalink
JOLT-407 some cleanup and removing console logs
Browse files Browse the repository at this point in the history
  • Loading branch information
abrathovde authored and Milo Simpson committed Apr 30, 2018
1 parent 677b443 commit 76b83b2
Showing 1 changed file with 23 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,33 @@ public static final class substring extends Function.ListFunction {

@Override
protected Optional<Object> applyList(List<Object> argList) {
String argString = "";
int start = -1;
int end = -1;
for(int i = 0; i < argList.size(); i++) {
Object arg = argList.get(i);
if(arg != null) {
if(i == 0 && arg instanceof String) {
argString = arg.toString();
}
else if(i == 1 && arg instanceof Integer) {
start = (Integer) arg;
} else if(i == 2 && arg instanceof Integer) {
end = (Integer) arg;
if(argList == null) {
return Optional.of("");
} else {
String argString = "";
int start = 0;
int end = 0;
for(int i = 0; i < argList.size() && i <= 2; i++) {
Object arg = argList.get(i);
if(arg != null) {
if(i == 0 && arg instanceof String) {
argString = arg.toString();
}
else if(i == 1 && arg instanceof Integer) {
start = (Integer) arg;
} else if(i == 2 && arg instanceof Integer) {
end = (Integer) arg;
}
}
}
}
System.out.println(argString + " start: " + Integer.toString(start) + " end: " + Integer.toString(end));
if(start >= 0 && end > 0 && argString.length() > 0) {
if(start < argString.length() && end <= argString.length() && start < end) {
return Optional.of(argString.substring(start, end));
if(start >= 0 && end > 0 && argString.length() > 0) {
if(start < argString.length() && end <= argString.length() && start < end) {
return Optional.of(argString.substring(start, end));
}
}
}

return Optional.of("");
return Optional.of("");
}
}
}

Expand Down

0 comments on commit 76b83b2

Please sign in to comment.