private Template extractLoopBody(String tagName) {
        String closingTag = "{{/" + tagName + "}}";
        int endOfBody = template.indexOf(closingTag, index);
        Template body = new Template(template.substring(index, endOfBody));
        index = endOfBody + closingTag.length();
        return body;
    }
A single class templating library for doing runtime code-gen.

Not Threadsafe.
jctools-channels/src/main/java/org/jctools/util/Template.java