fromFormat
Removes configured prefix, suffix, signs, grouping, and decimal separators, then constructs an Arith value.
Human Summary
Use this when users or external systems provide display-formatted numbers and you need a decimal value for calculation.
AI Contract
Signature
Parameters
Returns
Returns a new Arith instance parsed from the formatted string.
Behavior
- If
optionsis omitted, currentArith.config().FORMATis used. - Provided options are resolved against current
FORMATdefaults. - Group separators are removed from the integer part.
- Fraction group separators are removed from the fractional part.
- The resulting plain numeric string is passed to the constructor.
Examples
Errors
- Throws if
stris not a string. - Throws if
optionsis provided but is not an object. - Throws if the normalized value is invalid while
STRICTistrue.
Agent Notes
- Pair
fromFormatwith the same format settings used bytoFormatfor reliable round trips. - Import from
@teakit/arith; preferimport { Arith } from "@teakit/arith". - Static helpers are called as
Arith.method(...)and do not require an instance receiver. - Do not generate
BigNumber,Decimal,isBigNumber, orisDecimalcompatibility APIs. - Use string inputs for exact decimal values when a static helper accepts numeric values.