Link | pk_stringtointeger |
Author | Pier Kuipers |
Category | String |
Version | 8.x |
License | Public Domain |
Posted | 10 Jan 2006 |
Updated | 28 Jan 2007 |
More by this author... |
Tag converts a formatted number such as $100,000 back to an integer (e.g. 100000).
Note the difference with Bil's tag [lp_string_getNumeric] - my tag returns the integer value, ignoring digits after a period:
[pk_stringtointeger] $100,000.45 -> 100000
[lp_string_getNumeric] $100,000.45 -> 10000045
[pk_stringtointeger:'$100,000.45'] -> 100000 [pk_stringtointeger:'+1-234 yada 23-65/01'] -> 1234236501 [pk_stringtointeger:'+1-234 yada. 23-65/01'] -> 1234
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.
split:''); local:'newinteger'=string; Iterate:#splitString, local:'x'; If:(#x -> isdigit); #newinteger += #x; Else:(#x == '.'); loop_abort; /If; /Iterate; return:(integer:#newinteger); /define_tag; /If; ?>
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft