• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.2 <xen:helper snippet> Can I snip the last four characters in a text

Marcus

Well-known member
#1
Is there a way to snip the last four charactes of a string with a template helper? Like Bank Account Number 02349234234xxxx?

Or is there a template helper that turns the string around, then I strip the first four characters, and turn it around again.
 

Chris D

XenForo developer
Staff member
#2
Code:
{xen:string wordtrim, $number, 11, 0, xxxx}
Parameters:
  1. $number = the string
  2. $maxLength = the maximum length of the string (not including $elipses)
  3. $offset = starting position
  4. $elipses = string to append to end of the string
Only problem with it is having to know the length of the string. But there's some template functions to calculate that too, I think. But hopefully the length of the strings are predictable.