[lp_string_asc]
Description
Returns the base10 integer value given a text character.
Requires [lp_math_dectobin] [lp_math_bintodec] [lp_integer_toUnsigned]
Parameters
-chr
string, required
The character to return the base10 integer value of.
-text_encoding
string, optional
The character encoding of the character. Default is the outgoing encoding.
Sample Usage
[
var:'a' = (lp_string_chr: (array: 195, 164));
$a ' = ';
(lp_string_asc: $a);
' or ';
(lp_math_dectooctet:(lp_string_asc: $a));
'<br>';
(lp_string_chr: 50084);
]
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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[
define_tag:'lp_string_asc',
-description='Returns the base10 integer value given a text character.',
-priority='replace',
-required='chr',
-optional='text_encoding';
// usage: [asc: 'T'] returns 84
if: !(local_defined:'text_encoding');
local:'text_encoding' = $__encoding__;
/if;
local:'bytes' = bytes;
#bytes->(importstring: #chr, #text_encoding);
local:'return' = string;
local:'loop' = #bytes->size;
loop: #loop;
#return += (lp_math_dectobin: (lp_integer_toUnsigned:(#bytes->export8bits)));
/loop;
return: (lp_math_bintodec: #return);
/define_tag;
]
Related Tags
Comments
none
Newest
Most Popular