Skip to content

Conversation

n5m
Copy link
Contributor

@n5m n5m commented Sep 25, 2022

Fix #18128

All the relevant test cases discussed in the linked issue pass now

import strutils

doAssert "abc".find("") == 0
doAssert "abc".rfind("") == 3

doAssert "abc".find("") == 0
doAssert "abc".rfind("") == 3
doAssert "abc".rfind("c") == 2
doAssert "abc".rfind("bc") == 1
doAssert "abc".rfind("abc") == 0

doAssert "abc".find("") == 0
doAssert "abc".find("a") == 0
doAssert "abc".find("ab") == 0
doAssert "abc".find("abc") == 0

@n5m n5m changed the title rfind on empty needle returns haystack len fix #18128 rfind on empty needle returns haystack len Sep 25, 2022
@n5m n5m changed the title fix #18128 rfind on empty needle returns haystack len fix #18128 rfind on empty needle returns rightmost index Sep 25, 2022
@Varriount Varriount merged commit 9ca88a1 into nim-lang:devel Sep 26, 2022
@github-actions
Copy link
Contributor

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from 9ca88a1

Hint: mm: orc; threads: on; opt: speed; options: -d:release
164117 lines; 16.388s; 840.582MiB peakmem

capocasa pushed a commit to capocasa/Nim that referenced this pull request Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

find and rfind differ on empty needle
2 participants