Fixed Issue 447: Extend toTitlecase() function with support for char[] delimiters in Apache WordUtils.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@2247 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
db3bbb5c86
commit
9111157172
@ -44,14 +44,15 @@ import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
|
||||
public class ToTitlecase implements Function {
|
||||
|
||||
final static private char[] delimiters = { ' ', '\t', '\r', '\n', '.' };
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1 && args[0] != null) {
|
||||
Object o = args[0];
|
||||
String s = o instanceof String ? (String) o : o.toString();
|
||||
|
||||
return WordUtils.capitalizeFully(s);
|
||||
return WordUtils.capitalizeFully(s, delimiters);
|
||||
}
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a string");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user