Gemstone Common Library
Show/Hide TOC

# SI2ToScaledString(Int64, String, String, String, Int32, Int64, Int64) Method

Turns the given number of units (e.g., bytes) into a textual representation with an appropriate unit scaling given string array of factor names or symbols.

## Definition

Namespace: Gemstone.Units
Assembly: Gemstone.Common (in Gemstone.Common.dll) Version: 1.0.173 -- Release Build+298e1c238b074757f82f41812034645402a162ed
C#
View Source Request Example

    public static string ToScaledString(
    	long totalUnits,
    	string format,
    	string unitName,
    	string[] symbolNames,
    	int decimalPlaces = -1,
    	long minimumFactor = 1024,
    	long maximumFactor = 1152921504606846976
    )

VB
View Source Request Example

    Public Shared Function ToScaledString (
    	totalUnits As Long,
    	format As String,
    	unitName As String,
    	symbolNames As String(),
    	Optional decimalPlaces As Integer = -1,
    	Optional minimumFactor As Long = 1024,
    	Optional maximumFactor As Long = 1152921504606846976
    ) As String

C++
View Source Request Example

    public:
    static String^ ToScaledString(
    	long long totalUnits,
    	String^ format,
    	String^ unitName,
    	array<String^>^ symbolNames,
    	int decimalPlaces = -1,
    	long long minimumFactor = 1024,
    	long long maximumFactor = 1152921504606846976
    )

JavaScript
View Source Request Example

    Gemstone.Units.SI2.ToScaledString = function(totalUnits, format, unitName, symbolNames, decimalPlaces, minimumFactor, maximumFactor);

#### Parameters

totalUnits Int64
  Total units to represent textually.
format String
  A numeric string format for scaled totalUnits.
unitName String
  Name of unit display (e.g., you could use "B" for bytes).
symbolNames String
  SI factor symbol or name array to use during textual conversion.
decimalPlaces Int32 (Optional)
  Optional number of decimal places to display.
minimumFactor Int64 (Optional)
  Optional minimum SI factor. Defaults to Kilo.
maximumFactor Int64 (Optional)
  Optional maximum SI factor. Defaults to Exa.

#### Return Value

String
A String representation of the number of units.

## Remarks

The symbolNames array needs one string entry for each defined SI item ordered from least (Kilo) to greatest (Exa), see Names or Symbols arrays for examples.

## Exceptions

ArgumentOutOfRangeException | minimumFactor or maximumFactor is not defined in Factors array.

## See Also

#### Reference

SI2 Class
ToScaledString Overload
Gemstone.Units Namespace