smarty

Count number of characters in a string in smarty

We can count number of characters in a string through the smarty.
Smarty provide a modifier called “count_characters”.

{$str|count_characters}

Above statement will display the number of characters in the string excluding the white-spaces.

{$str|count_characters:true}

Above statement will display the number of characters in the string including the white-spaces.

Share and Enjoy

  • Facebook
  • Twitter
  • Google Plus
  • Live
  • Delicious
  • Digg
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS
  • Instapaper
  • FriendFeed