liqp.filters.Remove Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of liqp Show documentation
Show all versions of liqp Show documentation
A Java implementation of the Liquid templating engine backed up by an ANTLR grammar.
package liqp.filters;
import liqp.TemplateContext;
public class Remove extends Filter {
/*
* remove(input, string)
*
* remove a substring
*/
@Override
public Object apply(Object value, TemplateContext context, Object... params) {
String original = super.asString(value, context);
Object needle = super.get(0, params);
if (needle == null) {
throw new RuntimeException("invalid pattern: " + needle);
}
return original.replace(String.valueOf(needle), "");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy