(require("@nginstack/engine/lib/number/parseNumber"))(value [, options])
Converte string para número.
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
value |
string | String a ser convertida |
|
options |
ParseOptions |
<optional> |
Opções de parsing |
Returns:
Número convertido ou NaN se inválido
- Type
- number
Methods
-
<inner> countDigits(text, start)
-
Conta dígitos consecutivos a partir de uma posição
Parameters:
Name Type Description textstring Texto
startnumber Posição inicial
Returns:
Número de dígitos
- Type
- number
-
<inner> isDigit(char)
-
Verifica se um caractere é dígito
Parameters:
Name Type Description charstring Caractere a verificar
Returns:
True se for dígito
- Type
- boolean
-
<inner> isValidGrouping(text, separator)
-
Valida padrão de agrupamento para um separador específico
Parameters:
Name Type Description textstring Texto
separatorstring Separador ('.' ou ',')
Returns:
True se válido
- Type
- boolean
-
<inner> validateEnUs(text)
-
Valida número no formato en-us (ponto decimal, vírgula agrupador)
Parameters:
Name Type Description textstring Texto limpo (sem sinais)
Returns:
True se válido
- Type
- boolean
-
<inner> validatePtBr(text)
-
Valida número no formato pt-br (vírgula decimal, ponto agrupador)
Parameters:
Name Type Description textstring Texto limpo (sem sinais)
Returns:
True se válido
- Type
- boolean
Type Definitions
-
ParseOptions
-
Type:
- Object
Properties:
Name Type Argument Description locale'pt-br' | 'en-us' <optional>
minPrecisionnumber <optional>
maxPrecisionnumber <optional>