
Replaced gel with grel in other places in the code base while maintaining backward compatibility. Changed layout in expression preview dialog to accommodate long GREL name. git-svn-id: http://google-refine.googlecode.com/svn/trunk@1442 7d457c2a-affb-35e4-300a-418c747d4874
32 lines
960 B
Java
32 lines
960 B
Java
package com.google.refine.expr.functions.strings;
|
|
|
|
import java.util.Properties;
|
|
|
|
import org.json.JSONException;
|
|
import org.json.JSONWriter;
|
|
|
|
import com.google.refine.grel.Function;
|
|
|
|
public class Contains implements Function {
|
|
|
|
public Object call(Properties bindings, Object[] args) {
|
|
if (args.length == 2) {
|
|
Object s1 = args[0];
|
|
Object s2 = args[1];
|
|
if (s1 != null && s2 != null && s1 instanceof String && s2 instanceof String) {
|
|
return ((String) s1).indexOf((String) s2) > -1;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
public void write(JSONWriter writer, Properties options)
|
|
throws JSONException {
|
|
|
|
writer.object();
|
|
writer.key("description"); writer.value("Returns whether s contains frag");
|
|
writer.key("params"); writer.value("string s, string frag");
|
|
writer.key("returns"); writer.value("boolean");
|
|
writer.endObject();
|
|
}
|
|
}
|