-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Wrong behavior of "runeSubstr" from module "unicode". #17768
Labels
Comments
A worse example: import std/unicode
let s4 = "白头如新倾盖如故"
echo s4.runeSubStr(-10, 3)
Not to say import std/unicode
let s4 = "白头如新倾盖如故"
doAssert s4.runeSubStr(-10, 10) == "白头如新倾盖如故" works. Well as documentation said, it is meant to work. But it is really terrible and unnatural. import std/unicode
let s4 = "白头如新倾盖如故"
echo s4.runeSubStr(-10, -1) This doesn't work
|
ringabout
added a commit
to ringabout/Nim
that referenced
this issue
Jun 21, 2021
ringabout
added a commit
to ringabout/Nim
that referenced
this issue
Jun 21, 2021
Araq
pushed a commit
that referenced
this issue
Jun 21, 2021
narimiran
pushed a commit
that referenced
this issue
Aug 24, 2021
PMunch
pushed a commit
to PMunch/Nim
that referenced
this issue
Mar 28, 2022
* fixes nim-lang#17768 [backport:1.4] * tiny
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Proc "runeSubstr" from module "unicode" is broken for negative lengths.
Example
Current Output
Expected Output
Possible Solution
Replacing the negative indexes with the following works:
Additional Information
Issue also exists in development version.
The text was updated successfully, but these errors were encountered: