FastDoubleParser

class FastDoubleParser(parserOptions: ParserOptions? = null)

Parses a String/CharSequence, CharArray, or ByteArray into a Double.

If ParserOptions.useFastDoubleParser is enabled, it will try to parse the input with the fast double parser library, FastDoubleParser. If not, or if it fails, it will use NumberFormat to parse the input.

The locale used by the double parser is defined like:

parserOptions?.locale?: Parsers.locale:? Locale.getDefault()

FastDoubleParser has a fallback mechanism; In practice, this means it can recognize symbols and notations of any locale recognized by Java as long as that symbol does not conflict with the given locale.

For example, if your locale uses ',' as decimal separator, it will NOT recognize ',' as thousands separator, but it will recognize ' ', '٬', '_', ' ', etc. as such. The same holds for characters like "e", "inf", "×10^", "NaN", etc.

Public, so it can be used in other modules.

Parameters

parserOptions

can be supplied to configure the parser. If null, the global parser options (DataFrame.parser) will be used. We'll only use ParserOptions.locale and ParserOptions.useFastDoubleParser.

Constructors

Link copied to clipboard
constructor(parserOptions: ParserOptions? = null)

Types

Link copied to clipboard
internal object Companion

Here we store all possible decimal format symbols of all locales on the system. These will be used as fallbacks for the selected locale. They are only added by withFallback if they don't interfere with symbols already in the provided locale (so ',' is not added as grouping separator if '.' is already the locale's decimal separator).

Functions

Link copied to clipboard

Parses a double value from the specified CharSequence.

fun parseOrNull(ca: CharArray, offset: Int = 0, length: Int = ca.size): Double?

Parses a double value from the specified CharArray.

fun parseOrNull(ba: ByteArray, offset: Int = 0, length: Int = ba.size, charset: Charset = Charsets.UTF_8): Double?

Parses a double value from a substring of the specified byte array.