On Fri, 14 Jul 2017 16:27:49 -0700, Rodrigo Damazio via Mercurial-devel wrote:
> On Fri, Jul 14, 2017 at 3:48 PM, Rodrigo Damazio Bovendorp <
> rdama...@google.com> wrote:
> > # HG changeset patch
> > # User Rodrigo Damazio Bovendorp <rdama...@google.com>
> > # Date 1500072378 25200
> > #      Fri Jul 14 15:46:18 2017 -0700
> > # Node ID 0ccebbd04efbd672fc71df7f52ec243057cbed7d
> > # Parent  c0d8de2724ce6240d2a4241aff78ce2ee92359c2
> > templates: add substring and string length operations

> > +@templatefilter('strlen')
> > +def stringlen(text):
> > +    """Any text. Turns the value into its length."""
> > +    return len(text)

You can use "str|count" instead.

> > +@templatefunc('substr(text, start[, end])')

I think substr() generally takes offset and length, not start:end range.
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to