TransactionParser
    Preparing search index...

    Class FormatterExperimental

    The Fromatter class contains helper functions to convert the value of a DataItem into a COBOL-style, fixed-width string

    Index

    Constructors

    Methods

    • Experimental

      Format a numeric value into a fixed-width digit string based on total length and implied decimal

      Parameters

      • value: string | number

        [number|string] The value to format

      • length: number

        [number] Length of the field

      • opts: INumericFormatOptions = {}

        [INumericFormatOptions] Optional formatting options

      Returns string

      String representation of the numeric value

      The returned string contains only digits and no decimal point.

      If signed is true in the opts and value is negative, the returned string will be prefixed with -. The sign character is not counted towards length

      Throws error when the value has more digits than length aftre applying decimals

    • Experimental

      Formats string to the provided length. Adds spaces at the end

      Parameters

      • value: any
      • length: number

      Returns string

      string