ad_string_truncate_middle (public)
ad_string_truncate_middle [ -ellipsis ellipsis ] [ -len len ] string
Defined in packages/acs-tcl/tcl/text-html-procs.tcl
Cut middle part of a string in case it is too long.
- Switches:
- -ellipsis (optional, defaults to
"..."
)- placeholder for the portion of text being left out
- -len (optional, defaults to
"100"
)- length after which we are starting cutting text
- Parameters:
- string (required)
- Returns:
- truncated string
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- ad_string_truncate_middle
Source code: set string [string trim $string] if {[string length $string]>$len} { set half [expr {($len-2)/2}] set left [string trimright [string range $string 0 $half]] set right [string trimleft [string range $string end-$half end]] return $left$ellipsis$right } return $stringXQL Not present: Generic, PostgreSQL, Oracle