π₯ Breaking changes
- Deprecated exception class
UnsupportedPlatformExceptionhas been removed, catchPlatformExceptioninstead
The following breaking change only affects you if you specifically catch DivisionByZeroException around calls to of() or to any method accepting strings:
of()now throwsNumberFormatExceptioninstead ofDivisionByZeroExceptionwhen the string is a fraction with a denominator of zero, such as'2/0'
β¨ New features
- New methods:
parse()andparseNullable()safely parse untrusted input, by restricting the allowed syntax and limiting the number of digits - New enum:
NumberSyntaxlists the syntax features thatparse()can accept, with constants for the most common combinations
π Bug fixes
of()no longer throwsPlatformExceptionon malformed input with many digits, crafted to trigger heavy backtracking in its parser; such input now throwsNumberFormatExceptionas documented
π Improvements
NumberFormatExceptionmessages now escape control and non-ASCII characters, and truncate values longer than 40 bytes, instead of copying the raw input into the message