Lasso Soft Inc. > Home

[valid_routingnumber]

Linkvalid_routingnumber
AuthorJustin Dennis
CategoryCustom Tag
Version8.5.x
LicensePublic Domain
Posted12 Apr 2013
Updated12 Apr 2013
More by this author...

Description

Validate bank routing number using ABA check digit algorithm.

Sample Usage

valid_routingnumber('123123123');
->false

valid_routingnumber('063000047');
->true

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('valid_routingnumber', -required='routingnumber');
	local(	'digits'		= #routingnumber->split(''),
			'multiplicands'	= array(3,7,1,3,7,1,3,7),
			'checksum'		= integer,
			'minuend'		= integer,
			'checkdigit'	= integer);
	var('test' = null);

	if(#digits->size != 9);
		return(false);
	/if;
	
	loop(8);
		#checksum += integer(#digits->get(loop_count)) * #multiplicands->get(loop_count);
	/loop;

	#minuend = math_ceil(#checksum/10.0)*10;
	
	#checkdigit = #minuend - #checksum;
	
	if(#digits->get(9) == #checkdigit);
		return(true);
	else;
		return(false);
	/if;

/define_tag;

Comments

No comments

Please log in to comment

LassoSoft Inc. > Home

 

 

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