Download the PHP package mvccore/ext-tool-locale-floatparser without Composer
On this page you can find all versions of the php package mvccore/ext-tool-locale-floatparser. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mvccore/ext-tool-locale-floatparser
More information about mvccore/ext-tool-locale-floatparser
Files in mvccore/ext-tool-locale-floatparser
Package ext-tool-locale-floatparser
Short Description MvcCore - Extension - Tool - Locale - FloatParser - parse float by automatic floating point detection or parse float value by `Intl` extension.
License BSD-3-Clause
Informations about the package ext-tool-locale-floatparser
MvcCore - Extension - Tool - Locale - FloatParser
Parse float by automatic floating point detection or parse float value by Intl
extension.
Installation
Usage
Non Intl
Automatic Floating Point Detection
Non Intl
parsing with automatic floating point detection
has better results for unexpected user inputs like:
'1.2 3' => 1.23 (float)
'1.2 3 and 4' => 1.234 (float)
'-1,234,567.89' => -1234567.89 (float)
'-1.234.567,89' => -1234567.89 (float)
'-1 234 567.89' => -1234567.89 (float)
'-1 234 567,89' => -1234567.89 (float)
Example
Intl
Parsing
Intl
parser needs to set up language and locale more precisely
to user input expectations, which is more error prone in very
foreing languages and their locale conventions.
Mostly all languages use floating point character .
or ,
, but Intl
library has sometimes not the same values for floating point char in
specific locale as operation system has for specific locale, there is
a little mess. That's why sometimes there is better to use non Intl
floating point parsing.