Documents for @litert/utils-string
    Preparing search index...

    This class helps to extract a value and a unit from a string, by the given format.

    Index

    Constructors

    Properties

    caseInsensitive: boolean

    Whether to ignore case when matching the unit.

    format: string

    The format of the string to parse.

    maxDecimalPlaces: number

    The maximum number of decimal places to allow.

    units: readonly Readonly<IUnitInfo>[]

    The names of the units to parse.

    Methods

    • Extract the value and unit from the given string.

      Parameters

      • input: string

        The string to parse.

      Returns null | IUnitParserResult

      An object containing the value and unit, or null if the string does not match the format.