Takes two parameters, Source, MaxLength
Description:
This command can be used to truncate a text/string value. If the number of bytes in the Source parameter is equal to, or less than MaxLength parameter, the original Source will be returned. If it is longer, it is truncated after the last complete word and "…"
is added to the string. If only one partial word fits within MaxLength, then MaxLength - 3 will be returned with "…"
added to the string. Note that the "…"
UTF-8 character is 3 bytes long.
If MaxLength is less than zero, then that number of bytes will be truncated from the end (right) of the string.
Example:
[New] source = "abcdefg hijklmnop qrstuv"
Html (Truncate$ source, 4) 'a…
Html (Truncate$ source, 9) 'abcdef…
Html (Truncate$ source, 12) 'abcdefg…
Html (Truncate$ source, -4) 'abcdefg hijklmnop…