Monday, November 08, 2010 at 12:05 AM.
system.verbs.builtins.string.gigabyteString
on gigabyteString (size) { <<display size in gigabytes, the next step after string.megabyteString
<<New verb: 5/5/00; 10:20:20 AM by DW
<<http://docserver.userland.com/string/gigabyteString
size = double (size);
local (onegig = 1024 * 1024 * 1024);
if size <= onegig {
return (string.megabyteString (number (size)))};
local (rawgigs = size / onegig);
local (leftofdecimal = string.nthfield (rawgigs, ".", 1));
local (rightofdecimal = string.nthfield (rawgigs, ".", 2));
return (leftofdecimal + "." + rightofdecimal [1] + "GB")}
<<bundle //test code
<<dialog.alert (string.gigabyteString (file.volumeSize (file.volumeFromPath (Frontier.getProgramPath ()))))
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.