May 18

Truncate a String to a Specific Length Function (trunkString)

Truncates a string to a given length and adds a "…" at the end. If the string is not truncated (shorter than max) returns the same string that was sent.

function trunkString(strIn,intLength)
	if len(strIn) <= intLength then
		trunkString = strIn 
		trunkString = left(strIn,(intLength-3)) & "..."
	end if
end function

Permanent link to this article:

Leave a Reply

Your email address will not be published.