Merge pull request #3689 from rtfeldman/fix/3685-Str.splitLast

Fix Str.splitLast for needle positioned last
This commit is contained in:
Folkert de Vries 2022-08-03 13:27:25 +02:00 committed by GitHub
commit b4880ae66f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -334,7 +334,7 @@ lastMatch : Str, Str -> [Some Nat, None]
lastMatch = \haystack, needle ->
haystackLength = Str.countUtf8Bytes haystack
needleLength = Str.countUtf8Bytes needle
lastPossibleIndex = Num.subSaturated haystackLength (needleLength + 1)
lastPossibleIndex = Num.subSaturated haystackLength needleLength
lastMatchHelp haystack needle lastPossibleIndex