Link | lp_string_ucs |
Author | Bil Corry |
Category | String |
Version | 8.x |
License | Public Domain |
Posted | 06 Dec 2005 |
Updated | 07 Dec 2005 |
More by this author... |
Returns the UCS decimal value of a given character. Optionally may return it as a hex or binary value. Empty strings and nulls return the value zero.
Requires [lp_math_dectohex], [lp_math_dectobin]
lp_string_ucs:'a';'
'; // returns 97 lp_string_ucs:'a',-hex;'
'; // returns 61 lp_string_ucs:'a',-bin;'
'; // returns 1100001 lp_string_ucs:'ä';'
'; // returns 228 lp_string_ucs:'ä',-hex;'
'; // returns E4 lp_string_ucs:'ä',-bin;'
'; // returns 11100100
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_ucs', -description='Returns the UCS decimal value of a given character.', -priority='replace', -required='char', -copy; // http://www.unicode.org/charts/ // http://www.426.ch/ascii.html #char = string: #char; if: #char->size == 0; return: 0; /if; if: params->(find: '-hex')->size; return: (lp_math_dectohex: #char->(get:1)->integer); else: params->(find: '-bin')->size; return: (lp_math_dectobin: #char->(get:1)->integer); /if; // default = decimal return: #char->(get:1)->integer; /define_tag; ]
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft