Link | lp_string_chr |
Author | Bil Corry |
Category | String |
Version | 8.x |
License | Public Domain |
Posted | 17 Jan 2006 |
Updated | 03 Dec 2007 |
More by this author... |
Returns a character given an integer octet or an array of integer octets.
Requires [lp_math_decToOctet], [lp_math_hexToDec]
For UTF-8: [lp_string_chr: (lp_math_hextodec: 'C2A9')]
[lp_string_chr: 84] returns 'T'
[lp_string_chr: (array: 195, 164)] returns ä (a with umlaut)
[lp_string_chr: 50084] returns ä (a with umlaut)
[lp_string_chr: (array: 226,130,172)] returns euro symbol
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_chr', -description='Returns a character given an integer octet or an array of integer octets.', -priority='replace', -required='bytes', -copy, -optional='character_set', -optional='hex'; // http://www.unicode.org/charts/ // http://www.426.ch/ascii.html if: (local_defined:'hex'); #bytes = (array: (lp_math_hexToDec:(string: #bytes))); /if; if: #bytes->type != 'array'; #bytes = (array: (integer: #bytes)); /if; if: !(local_defined:'character_set'); local:'character_set' = $__encoding__; /if; local:'return' = bytes; iterate: (lp_math_decToOctet: #bytes), local:'octet'; #return->(import8bits: #octet); /iterate; return: #return->(exportstring: #character_set); /define_tag; ]
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft