STARTED - task 604: The common transform “Trim leading and trailing whitespace” doesn’t trim non-breaking spaces

http://code.google.com/p/google-refine/issues/detail?id=604

git-svn-id: http://google-refine.googlecode.com/svn/trunk@2528 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Tom Morris 2012-08-14 20:09:49 +00:00
parent 40dbe79a03
commit f29f77e8f8

View File

@ -38,6 +38,8 @@ import java.util.Properties;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONWriter; import org.json.JSONWriter;
import com.google.gdata.util.common.base.CharMatcher;
import com.google.refine.grel.Function; import com.google.refine.grel.Function;
public class Trim implements Function { public class Trim implements Function {
@ -47,7 +49,7 @@ public class Trim implements Function {
if (args.length == 1) { if (args.length == 1) {
Object s1 = args[0]; Object s1 = args[0];
if (s1 != null && s1 instanceof String) { if (s1 != null && s1 instanceof String) {
return ((String) s1).trim(); return CharMatcher.WHITESPACE.trimFrom((String) s1);
} }
} }
return null; return null;