Sanitization
Numora sanitizes every value through a sequential pipeline before formatting is applied. For the full architecture and pipeline diagram, see How It Works. The sections below cover each configurable sanitization feature.
Non-numeric Character Filtering
Numora automatically removes invalid characters while preserving:
- Digits (0-9)
- Decimal separator (configured via
decimalSeparator) - Negative sign (
-) ifenableNegativeis true
Try typing letters or special characters - only numbers will be kept
tsx
import { NumoraInput } from 'numora-react'
<NumoraInput maxDecimals={2} />removeThousandSeparators
Numora exports a standalone removeThousandSeparators utility from the core package for stripping thousand separators from a formatted string. Useful when you need to extract a raw numeric value from a display string.
(You can also access the raw value directly via e.target.value in onChange - separators are always stripped.)
tsx
import { removeThousandSeparators } from 'numora'
removeThousandSeparators('1,234,567.89', ',') // → '1234567.89'
removeThousandSeparators('1.234.567,89', '.') // → '1234567,89'
removeThousandSeparators('1 234 567', ' ') // → '1234567'