fix #19500; remove find optimization [backport: 1.6] (#19714)

* remove find optimization

close #19500

* save find to std

* add simple tests

* Apply suggestions from code review

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

Co-authored-by: sandytypical <43030857+xflywind@users.noreply.github.com>
Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
(cherry picked from commit 65c2518d5c)
This commit is contained in:
ringabout
2022-09-29 04:05:41 +08:00
committed by narimiran
parent 5abf259908
commit ce63020110
3 changed files with 53 additions and 25 deletions

View File

@@ -0,0 +1,6 @@
import std/private/strimpl
doAssert find(cstring"Hello Nim", cstring"Nim") == 6
doAssert find(cstring"Hello Nim", cstring"N") == 6
doAssert find(cstring"Hello Nim", cstring"I") == -1
doAssert find(cstring"Hello Nim", cstring"O") == -1