Lasso Soft Inc. > Home


AuthorJonathan Guthrie
LicensePublic Domain
Posted05 Nov 2010
Updated05 Nov 2010
More by this author...


String_Truncate takes three parameters: an input string, a -Length integer, and an optional -Ellipsis string. It returns a string no longer than the specified -Length, appending the optional ellipsis if the string is actually truncated. If the input string is shorter than the specified length, the full input string is returned and no ellipsis is appended. Note: The length of the ellipsis is not counted when truncating the input string. The string is truncated to the specified length before the ellipsis is added.

Note, this is a port of John Burwell's tag for 8.x

Sample Usage


Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

define string_truncate(string::string,length::integer,ellipsis::string='...') => {
  // Returns a string truncated to the specified -Length. An optional -Ellipsis parameter specifies a string to append if the string is actually truncated.

	if(#string->Size <= #length) => {
	    return #string
		return string_extract(#string, -StartPosition=1, -EndPosition=#length) + #ellipsis
define string_truncate(string::string,-length::integer,-ellipsis::string='...') => {
  return string_truncate(#string,#length,#ellipsis)


No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home



©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft