-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add unicode.Rune.isNumeric, isDigit, isDecimal #7545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
In your PR, only ASCII digits are added. It isn't correct. |
lib/pure/unicode.nim
Outdated
| proc isDigit*(c: Rune): bool {.rtl, extern: "nuc$1", procvar.} = | ||
| ## Returns true iff ``c`` is a digit character | ||
| var c = RuneImpl(c) | ||
| return c in digitRanges |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like I can't check for digit like this... I need to rewrite this line.
|
Which Unicode version you used? See also nim-unicodedb and nim-unicodeplus libraries. Just for compatibility reasons. |
|
What kind of compatibility you are mean? As described, nim-unicodeplus is not drop-in replacement, so it must be used like this: import unicode except isDigit # like README.md example
import unicodeplusI think if we have Rune.isAlpha, we need to have Rune.isDigit in std lib. :) |
|
I mean that it would be nice to have |
|
You are right, but unfortunately I'm neither Unicode guru nor English guru. As described here, there are:
Should we use same naming rules or not? If yes, I just implemented |
|
You implemented checking for a decimal digits. LGTM. Let's wait for other opinions.
Me too :). Some useful links: |
|
The only thing I have to add to the table is that it looks like all those new procedures could share a common template implementation. |
|
Nice job, but all of these tables need to be generated from the Unicode spec. Otherwise it's a maintenance burden. I know the current code does it this way too, but I don't want to add more of the same bad stuff. |
|
Like this library - https://github.com/nitely/nim-unicodedb ? It generates all info from UCD |
|
@Yardanico Probably. |
|
No feedback, closing. |
No description provided.