Link | Valid_SSN |
Author | Chris Corwin |
Category | Utility |
Version | 8.x |
License | http://opensource.org/licenses/bsd-license.php |
Posted | 16 Nov 2005 |
Updated | 16 Jan 2006 |
More by this author... |
Returns (true|false) depending upon whether the input is valid or not. Has an optional -Strict parameter.
[//lasso local: 'somestrings' = (: '(317) 418-1795', '102-24-1879', '102241879', ) ; iterate(#somestrings, local('a_string')); ''; 'Input'; ''#a_string''; '' Valid_SSN(#a_string, -Strict) ''; 'strict'; '
'; ''; 'Input'; ''#a_string''; '' Valid_SSN(#a_string) ''; '
'; /iterate; ]
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.
[//lasso define_tag( 'SSN', -namespace='Valid_', -priority='replace', -description='Returns (true|false) depending upon whether the input is valid or not. Has an optional -Strict parameter.', -Required='Input' ); fail_if( !params->size, -1, '[Valid_SSN] requires a requires at least one parameter.' ); local( 'a_number' = string(#Input), 'regex_Loose' = '^\\d{3}[\\-]*\\d{2}[\\-]*\\d{4}$', 'regex_Strict' = '^\\d{3}\\-\\d{2}\\-\\d{4}$' ); if: (params) >> -Strict; Local: 'a_regex' = @#regex_strict; else; Local: 'a_regex' = @#regex_loose; /if; return(boolean(string_FindRegExp( #a_number, -Find=#a_regex)->size)); /define_tag; ]
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft