Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
99 views
in Technique[技术] by (71.8m points)

java - Why does Apache Commons consider '???' numeric?

According to Apache Commons Lang's documentation for StringUtils.isNumeric(), the String '???' is numeric.

Since I believed this might be a mistake in the documentation, I ran tests to verify the statement. I found that according to Apache Commons it is numeric.

Why is this String numeric? What do those characters represent?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Because that "CharSequence contains only Unicode digits" (quoting your linked documentation).

All of the characters return true for Character.isDigit:

Some Unicode character ranges that contain digits:

  • 'u0030' through 'u0039', ISO-LATIN-1 digits ('0' through '9')
  • 'u0660' through 'u0669', Arabic-Indic digits
  • 'u06F0' through 'u06F9', Extended Arabic-Indic digits
  • 'u0966' through 'u096F', Devanagari digits
  • 'uFF10' through 'uFF19', Fullwidth digits

Many other character ranges contain digits as well.

??? are Devanagari digits:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...