Formatting a File Size in Bytes for Display
15th October 2008
When working with files from Delphi you might want to display the size of a file to the user in a Explorer-like format where the file size is not displayed in bytes - but the display depends on the size of the actual file.
To most users “45678123 b” is confusing - where “43.56 MB” is much more user friendly.
Format Byte Size to String
A custom Delphi function, FormatByteSize, converts a byte value into a string that represents the number expressed as a size value in bytes, kilobytes, megabytes, or gigabytes, depending on the size.
Read the rest of this entry »
Posted in Snippet, Tips | No Comments »



