Link | PK_ByteSize |
Author | Pier Kuipers |
Category | Bytes |
Version | 7.x |
License | Public Domain |
Posted | 16 Nov 2005 |
Updated | 16 Nov 2005 |
More by this author... |
OK, Jason has already added a tag that does this, but I just happened to have this one floating around. The tag will take an integer which is assumed to be a number of bytes, and makes it readable, appending the appropriate "K", "MB", "GB" or "TB" at the end.
[PK_ByteSize:4427780] -> 4.20 MB
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.
(Get:1)); Local: 'displaysize' = (string); local:'kb' = 1024; local:'mb' = 1024 * #kb; local:'gb' = 1024 * #mb; local:'tb' = 1024 * #gb; if:(#size < #kb); local:'displaysize' = (#size + ' Bytes'); Else: (#size < #mb); local:'displaysize' = ((decimal: #size) / #kb); #displaysize -> setformat: -precision=0; #displaysize += ' KB'; Else: (#size < #gb); local:'displaysize' = ((decimal: #size) / #mb); #displaysize -> setformat: -precision=2; #displaysize += ' MB'; Else: (#size < #tb); local:'displaysize' = ((decimal:#size) / #gb); #displaysize -> setformat: -precision=2; #displaysize += ' GB'; Else; var:'displaysize' = ((decimal:#size) / #tb); #displaysize->setformat: -precision=2; #displaysize += ' TB'; /If; return: #displaysize ; /Define_Tag; /if; ?>
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft