pad

Summary

Makes sure a string is at least n characters long.

Usage

$input_string|pad( length [,padding] )

Parameters

NameTypeDescriptionRequired
length integer Desired length of string. yes
padding character Desired padding character. no

Returns

padded version of input string.

Description

Makes sure that the input string is at least length characters long by inserting extra characters at the end (padding). It is possible to specify what character to use with the optional padding parameter. Default pad character is the space character (' ', ascii 32).

Examples

Example 1

{"Too short!"|pad( 16 )}

returns the string "Too short! ".

Example 2

{"Too short!"|pad( 16, "-" )}

returns the string "Too short!------".

Comments

Contents

Reference

Database diagram
Template operators
    PDF
    Arrays
    Data extraction
    Formatting
    Images
    Logic
    Mathematics
    Miscellaneous
    Strings
       mimetype_icon
       append
       begins_with
       break
       ord
       compare
       concat
       contains
       count_chars
       count_words
       crc32
       downcase
       ends_with
       explode
       extract
       extract left
       extract_right
       indent
       insert
       md5
       nl2br
       chr
       pad
       prepend
       remove
       repeat
       reverse
       rot13
       shorten
       simplify
       trim
       upcase
       upfirst
       upword
       wash
       wordtoimage
       wrap
    URLs
    Variables
Template functions
Data fetching
Modules
XML tags


Created

05/02/2004
11:58:20 am
by Balazs Halasy

Last updated

18/02/2004
11:47:19 am
by Derick Rethans

Authors

Balazs Halasy
Derick Rethans



This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.