docs/bugpattern/CharacterGetNumericValue.md
Character.getNumericValue has unexpected behaviour: it interprets A-Z as
base-36 digits with values 10-35, but also supports non-arabic numerals and
miscellaneous numeric unicode characters like ㊷. For example:
Character.getNumericValue('V' /* ASCII V */) == 31Character.getNumericValue('Ⅴ' /* U+2164, Roman numeral 5 */) == 5Character.getNumericValue('௧' /* U+0BF2, Tamil Digit One */) == 1Character.getNumericValue('௲' /* U+0BF2, Tamil Number One Thousand */) == 1000Character.getNumericValue('㊷' /* U+32B7, Circled Number Forty Two */) == 42UCharacter.getNumericValue
has the same behavior.
Consider using:
UCharacter.getUnicodeNumericValue:
Handles all unicode codepoints with numeric values including fractions,
roman numerals, and other miscellaneous numeric characters. Returns the
value as a double. Does not assign a value to A-Z.Character.digit:
Handles unicode codepoints in the "decimal digit" category and the letters
A-Z which are interpreted as base-36 digits with values 10-35. Does not
handle characters like roman numerals and ㊷. You can use a radix value of
10 or less to avoid interpreting A-Z as digits.