String.GetFormattedSize

string String.GetFormattedSize ( 

number  SizeInBytes,

number  Format = FMTSIZE_AUTOMATIC,

boolean ShowCommas = true )

Description

Given a number of bytes, returns a formatted string that converts to bytes, KB, MB or GB and optionally inserts commas.

Parameters

SizeInBytes

(number) The number of raw bytes to convert.

Format

(number) The format to return. The following constants are defined:

CONSTANT

VALUE

DESCRIPTION

FMTSIZE_AUTOMATIC

1

Automatically choose the best format based on the size.

FMTSIZE_BYTES

2

Format the value in bytes.

FMTSIZE_KB

3

Format the value in Kilobytes.

FMTSIZE_MB

4

Format the value in Megabytes.

FMTSIZE_GB

5

Format the value in Gigabytes.

ShowCommas

(boolean) Whether to insert commas into the result (i.e. "63636" becomes "63,636").

Returns

(string) A formatted string given a number of bytes. If an error occurs, a blank string "" is returned. You can use Application.GetLastError to determine whether this action failed, and why.

ResultVariable

When adding an action with the action editor, you can use this field to specify a variable that the return value will be stored in.

See also:  Related Actions