Hmm, String.split() bites us again: use the commons-lang one instead to avoid having to escape regexp values (this was preventing a user from splitting by "." in GEL)
git-svn-id: http://google-refine.googlecode.com/svn/trunk@370 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
0e07ec7acc
commit
988378c761
@ -3,6 +3,7 @@ package com.metaweb.gridworks.expr.functions.strings;
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONWriter;
|
import org.json.JSONWriter;
|
||||||
|
|
||||||
@ -19,7 +20,7 @@ public class Split implements Function {
|
|||||||
if (v != null && split != null) {
|
if (v != null && split != null) {
|
||||||
String str = (v instanceof String ? (String) v : v.toString());
|
String str = (v instanceof String ? (String) v : v.toString());
|
||||||
if (split instanceof String) {
|
if (split instanceof String) {
|
||||||
return str.split((String) split);
|
return StringUtils.splitByWholeSeparator(str, (String) split);
|
||||||
} else if (split instanceof Pattern) {
|
} else if (split instanceof Pattern) {
|
||||||
Pattern pattern = (Pattern) split;
|
Pattern pattern = (Pattern) split;
|
||||||
return pattern.split(str);
|
return pattern.split(str);
|
||||||
|
Loading…
Reference in New Issue
Block a user