Extracted at 2014-06-26.
pike.ida.liu.se
[Top]
Tools
Tools.String

Method Tools.String.parse_filesize()


Method parse_filesize

int parse_filesize(string input)

Description

Parse a string containing a file size descriptor

Parameter input

a string describing a file size, such as: 2mb or 3.2gb, etc. This method understands bytes, kilobytes, megabytes and gigabytes. If no unit is provided, it assumes kilobytes. Common abbreviations are understood, as well.

Returns

an integer representing the number of bytes described by the input string.