ad_string_truncate (public)
ad_string_truncate [ -len len ] [ -ellipsis ellipsis ] [ -more more ] \ [ -equal ] string
Defined in packages/acs-tcl/tcl/text-html-procs.tcl
Truncates a string to len characters adding the string provided in the ellipsis parameter if the string was truncated. The length of the resulting string, including the ellipsis, is guaranteed to be shorter or equal than the len specified. Should always be called as ad_string_truncate [-flags ...] -- string since otherwise strings which start with a - will treated as switches, and will cause an error.
- Switches:
- -len (optional, defaults to
"200"
)- The length to truncate to. If zero, no truncation will occur.
- -ellipsis (optional, defaults to
"..."
)- This will get put at the end of the truncated string, if the string was truncated. However, this counts towards the total string length, so that the returned string including ellipsis is guaranteed to be shorter or equal than the 'len' provided.
- -more (optional)
- This will get put at the end of the truncated string, if the string was truncated.
- -equal (optional, boolean)
- Parameters:
- string (required)
- The string to truncate.
- Returns:
- The truncated string
- Author:
- Lars Pind <lars@pinds.com>
- Created:
- September 8, 2002
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- ad_string_truncate