svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.expressionevaluator / org.gvsig.expressionevaluator.lib / org.gvsig.expressionevaluator.lib.impl / src / main / java / org / gvsig / expressionevaluator / impl / function / string / SplitFunction.java @ 47095
History | View | Annotate | Download (751 Bytes)
1 |
package org.gvsig.expressionevaluator.impl.function.string; |
---|---|
2 |
|
3 |
import org.apache.commons.lang3.Range; |
4 |
import org.apache.commons.lang3.StringUtils; |
5 |
import org.gvsig.expressionevaluator.Interpreter; |
6 |
import org.gvsig.expressionevaluator.spi.AbstractFunction; |
7 |
|
8 |
public class SplitFunction extends AbstractFunction { |
9 |
|
10 |
public SplitFunction() {
|
11 |
super("String", "SPLIT", Range.is(2)); |
12 |
} |
13 |
|
14 |
@Override
|
15 |
public boolean allowConstantFolding() { |
16 |
return true; |
17 |
} |
18 |
|
19 |
@Override
|
20 |
public Object call(Interpreter interpreter, Object[] args) throws Exception { |
21 |
String str = getStr(args,0); |
22 |
String sep = getStr(args,1); |
23 |
String[] ret = StringUtils.splitPreserveAllTokens(str, sep); |
24 |
return ret;
|
25 |
} |
26 |
|
27 |
} |