Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter FiveGeneral Functions (continued)

IntegerToBinaryCombo Function

Overview

The IntegerToBinaryCombo function converts a 64-bit value to a string representation appropriate for representing sizes.

Syntax/Parameters

Syntax

string = IntegerToBinaryCombo ( qword value, [dword options] );

Parameters

value

An unsigned integer value (up to a 64-bit qword) as the source value.

options

Optional bitwise flags to direct the conversion of binary unit value. For all the binary unit functions, the following flags apply (combination in bitwise mode):

  Code Value   Comment
  Conversion Modes    
  ITBU_UNIT_MASK   0x0000000F   Unit Type Mask
  ITBU_UNIT_AUTO   0x00000000   Automatic Select of Units
  ITBU_UNIT_BYTES   0x00000001   Units as Bytes (bytes)
  ITBU_UNIT_K_BYTES   0x00000002   Units as Kilo Bytes (kb)
  ITBU_UNIT_M_BYTES   0x00000003   Units as Mega Bytes (mb)
  ITBU_UNIT_G_BYTES   0x00000004   Units as Gega Bytes (gb)
  ITBU_UNIT_T_BYTES   0x00000005   Units as Tera Bytes (tb)
  Modifier Flags    
  ITBU_NO_UNITS   0x00000010   Do Not Add Units
  ITBU_USE_10THS   0x00000020   Allow 10ths of Units
  ITBU_USE_100THS   0x00000040   Allow 100ths of Units
  ITBU_FRACTION_UP   0x00000080   Fraction Up (for example 1025 to 2K)
  Case Options    
  ITBU_CASE_MASK   0x00000F00   Case Type Mask
  ITBU_CASE_LOWER   0x00000000   Lower Case (bytes, mb, kb)
  ITBU_CASE_INITIAL   0x00000100   Initial Case (Bytes, Mb, Kb)
  ITBU_CASE_UPPER   0x00000200   Upper Case (BYTES, MB, KB)
  Space Options    
  ITBU_SPACE_MASK   0x0000F000   Space Mask
  ITBU_SPACE_AUTO   0x00000000   Space Auto (25 bytes, 16mb)
  ITBU_SPACE_ALWAYS   0x00001000   Space Always (25 bytes, 16 mb)
  ITBU_SPACE_NEVER   0x00002000   Space Never (25bytes, 16mb)

 

Return Value

Returns a string presenting the unit conversion of the provided value.

Remarks

The IntegerToBinaryCombo function is part of a series of functions that provide for the conversion of an integer to a binary or computer display versions of size. For example, 1,048,576 bytes is “1mb” in unit convention. The “combo” function combines that unit mode with bytes for a result of “1mb (1,048,576 bytes)”.

An example:

IntegerToBinaryCombo(1234567, ITBU_USE_10THS); 

Results in a string:

1.2mb (1,234,567 bytes)  

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic