Link | lp_string_linefeedSet |
Author | Bil Corry |
Category | String |
Version | 8.x |
License | Public Domain |
Posted | 03 Dec 2005 |
Updated | 03 Dec 2005 |
More by this author... |
Standardizes the line endings in a string.
[var:'test' = 'line_1\rline_2\nline_3\r\n']Before: [output: $test,-encodeurl] After: [output: (lp_string_linefeedSet:$test,'\r'),-encodeurl]
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:'lp_string_linefeedSet', -description='Standardizes the line endings in a string.', -priority='replace', -required='string', -optional='line_ending'; // usage: [lp_linefeed_set: $mystring, '\r'] to convert the line endings to \r // // or optionally leave off the line ending for \r\n local:'return' = string: #string; // default line ending is RFC line ending if: !(local_defined:'line_ending'); local:'line_ending' = '\r\n'; /if; // first, standarize the line ending to \r #return->(replace:'\r\n','\r'); #return->(replace:'\n','\r'); // now replace with line ending requested #return->(replace:'\r',#line_ending); return: @#return; /define_tag; ]
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft