Lasso Soft Inc. > Home

[PK_ByteSize]

LinkPK_ByteSize
AuthorPier Kuipers
CategoryBytes
Version7.x
LicensePublic Domain
Posted16 Nov 2005
Updated16 Nov 2005
More by this author...

Description

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.

Sample Usage

[PK_ByteSize:4427780] -> 4.20 MB

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.

(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;

?>

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