summaryrefslogtreecommitdiff
path: root/lib/std/strfind.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2018-03-24 22:49:10 -0700
committerOri Bernstein <ori@eigenstate.org>2018-03-24 23:13:51 -0700
commit34a0fe0d51a0bf0679d2d3b4c09140c8447dac2c (patch)
tree4bf0eb13572564dad05879346d3672a0fa7b362e /lib/std/strfind.myr
parentb39e8ca0f806bd6a76f378373cb4d27fcf028190 (diff)
downloadmc-34a0fe0d51a0bf0679d2d3b4c09140c8447dac2c.tar.gz
Handle zero length needles.
Diffstat (limited to 'lib/std/strfind.myr')
-rw-r--r--lib/std/strfind.myr3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/std/strfind.myr b/lib/std/strfind.myr
index 3645f8c..a874ea4 100644
--- a/lib/std/strfind.myr
+++ b/lib/std/strfind.myr
@@ -22,6 +22,9 @@ const strfindin = {haystack, needle, start, end
if start > end
inc = -1
;;
+ if needle.len == 0
+ -> `None
+ ;;
for var i = start; i != end; i += inc
/*
if we knew the direction we could terminate early,