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

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
hdriezen
Forum Members
Forum Members
Posts: 78
Joined: Fri Dec 17, 2010 7:59 am

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

Post 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
Last edited by hdriezen on Wed Aug 24, 2011 1:06 pm, edited 1 time in total.
Jos
Support Guru
Support Guru
Posts: 4020
Joined: Wed Sep 05, 2007 8:03 pm

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

Post by Jos »

Code: Select all

{capture name=some_content assign=anotherVar}{$anotherVar}{$oneVar|substr:-2}{/capture}
hdriezen
Forum Members
Forum Members
Posts: 78
Joined: Fri Dec 17, 2010 7:59 am

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

Post by hdriezen »

Great, Jos, many thanks!

Hans
Post Reply

Return to “CMSMS Core”