Lasso Soft Inc. > Home

[lp_string_asc]

Linklp_string_asc
AuthorBil Corry
CategoryString
Version8.x
LicensePublic Domain
Posted17 Jan 2006
Updated17 Jan 2006
More by this author...

Description

Returns the base10 integer value given a text character.

Requires [lp_math_dectobin] [lp_math_bintodec] [lp_integer_toUnsigned]

Sample Usage

[
	var:'a' = (lp_string_chr: (array: 195, 164));
	$a ' = ';
	(lp_string_asc: $a);
	' or ';
	(lp_math_dectooctet:(lp_string_asc: $a));
	'
'; (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.

[

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

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft