Link | gf_lowtext |
Author | Gaetano Frascolla |
Category | String |
Version | 8.x |
License | Public Domain |
Posted | 14 Jul 2006 |
Updated | 14 Jul 2006 |
More by this author... |
Based on [string_truncate] tag created by John Burwell, gf_lowtext returns truncated text to specified chars without truncate words, and add a suffix at the end of the string. It takes three params: an input -text, the lenght of the output and an optional suffix for the output. If the result ends with truncated word, this tag will remove the remaining chars, and will return a clean string.
[gf_lowtext: -text=($text), -chars=40, -suffix='...'] example: gf_lowtext: -text='Click the "Download" button below to retrieve a copy of this tag', -chars=40, -suffix='...' Only truncate: Click the "Download" button below to retr... Truncate and Clean Click the "Download" button below to...
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_Tag: 'gf_lowtext', -required='text', -required='chars', -optional='suffix', -description='Return text truncated to specified chars without truncate words'; Local:'long_text'=(String:(#text)); Local:'chars_lenght'=(Integer:(#chars)); Local:'text_suffix'=(String:(#suffix)); if: #long_text->(Size) > (#chars_lenght); Local:'new_text'=(#long_text)->(Substring: 1, (#chars_lenght)); While:(string_endswith:(#new_text), -find=' ')=='false'; Local:'chars_lenght'=(#chars_lenght)-1; Local:'new_text'=(#long_text)->(Substring: 1, (#chars_lenght)); /while; Local:'chars_lenght'=(#chars_lenght)-1; Local:'new_text'=(#long_text)->(Substring: 1, (#chars_lenght)); Local:'new_text' = (#new_text) + (#text_suffix); return:(#new_text); else; return:(#long_text); /if; /define_tag;
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft