Preparing search index...

    Function normalizeDecimalSeparators

    • Rewrites every decimal separator a user or the display layer may have produced into the dot that parseFloat understands.

      Accepts the fixed storageDecimalSeparator as well as the device region's own separator, which is what closes the round trip with formatDecimalForDisplay: whatever that renders, this reads back. Characters that are not separators are left untouched, so unit suffixes and OCR noise survive for the caller's own parsing.

      Parameters

      • raw: string

        The string to normalize

      Returns string

      The same string with every decimal separator rewritten to '.'

      // device region FR
      normalizeDecimalSeparators('12,75 g') // returns '12.75 g'
      // device region EG (Arabic decimal separator)
      normalizeDecimalSeparators('12٫75 g') // returns '12.75 g'