}
public StringFunctionExpression createStringFunction(String name, List<RutaExpression> args)
throws RutaParseException {
if (args == null || !(args.get(0) instanceof IStringExpression)) {
throw new RutaParseException("You have to specify StringExpressions to use these Functions !");
}
// ToUpperCase [0] is the String to change
if (name.equals(knownExtensions[0])) {
return new ToUpperCaseStringFunction((IStringExpression) args.get(0));
}
// ToLowerCase Function
else if (name.equals(knownExtensions[1])) {
return new ToLowerCaseStringFunction((IStringExpression) args.get(0));
}
// FirstCharToUppercase
else if (name.equals(knownExtensions[5])) {
return new FirstCharToUpperCaseStringFunction((IStringExpression) args.get(0));
}
if(args.size()!=3){
throw new RutaParseException("You need 3 Arguments to use ReplaceFirst, ReplaceAll, Substring");
}
// ReplaceFirst [0] is the String where stuff is to be replaced, [1] is the search term [2] is the replacement
if (name.equals(knownExtensions[2])) {
return new ReplaceFirstStringFunction((IStringExpression) args.get(0),(IStringExpression) args.get(1),(IStringExpression) args.get(2));
}