Page 1 of 1

[SOLVED]Smarty: how to get last two characters of a string

Posted: Wed Aug 24, 2011 12:23 pm
by hdriezen
Hopefully this is the right place to ask this question...

How do I get the last two characters of one variable/string into another variable/string?

Thanks!

Hans

Re: Smarty: how do I get the last two characters of a string

Posted: Wed Aug 24, 2011 12:58 pm
by Jos

Code: Select all

{capture name=some_content assign=anotherVar}{$anotherVar}{$oneVar|substr:-2}{/capture}

Re: Smarty: how do I get the last two characters of a string

Posted: Wed Aug 24, 2011 1:05 pm
by hdriezen
Great, Jos, many thanks!

Hans