Moved un/capitlize to RenderUtils

This commit is contained in:
Erik C. Thauvin 2023-03-21 23:12:03 -07:00
parent c55c8d803d
commit 9ff60a6f6b
5 changed files with 57 additions and 31 deletions

View file

@ -19,7 +19,6 @@ package rife.render;
import rife.template.Template;
import rife.template.ValueRenderer;
import rife.tools.Localization;
/**
* <p>Un-capitalizes a template value.</p>
@ -41,10 +40,6 @@ public class Uncapitalize implements ValueRenderer {
*/
@Override
public String render(Template template, String valueId, String differentiator) {
var value = template.getValueOrAttribute(differentiator);
if (value == null || value.isBlank()) {
return value;
}
return value.substring(0, 1).toLowerCase(Localization.getLocale()) + value.substring(1);
return RenderUtils.uncapitalize(template.getValueOrAttribute(differentiator));
}
}