0

I have this code

{foreach from=$last_user item=s}
  <span class="sp_1">{$s.username}</span>
{/foreach}  

I want only show three first letter of {$.username} .

If i need JavaScript or jQuery please write full code.

Pedram
  • 15,766
  • 10
  • 44
  • 73

1 Answers1

0

you just have to use substring(startingFromIndex, endingIndex)

{foreach from=$last_user item=s}
    <span class="sp_1">{$s.username.substring(0, 3)}</span>
{/foreach}

Here is a reference for a similar question

Ayyub Kolsawala
  • 809
  • 8
  • 15