[Templates] substr vmethod
Garrett, Philip (MAN-Corporate)
Philip.Garrett@manheim.com
Wed, 9 Aug 2006 11:50:28 -0400
Sergey Martynoff wrote:
>>> I thought I'd seen someone mention a substr vmethod
>>> on this list. I can't find anything about substrings in the manual.
>>>=20
>>> I need to display the first 34 chars. of a template
>>> variable. Is there some way to do that?
>>=20
>> Hackish, but should work:
>>=20
>> [% var.chunk(34).0 %]
>=20
> It is not too effective, I guess. The 'substr' vmethod works well:
>=20
> [% str.substr(0, 34) %]
There is no such 'substr' vmethod documented here:
http://www.template-toolkit.org/docs/default/Manual/VMethods.html#Scalar
_Virtual_Methods