Stream: beginners

Topic: splitFirst doesn't work properly


view this post on Zulip Kilian Vounckx (Sep 01 2022 at 13:59):

I was playing around with roc and I think I found a bug in the Str.splitFirst function. When calling splitFirst with 2 identical strings, it should return Ok { before: "", after: "", however it returns Err NotFound. If this is the intended behaviour, it is inconsistent with Str.splitLast.

I had a look in the source and I figured out the error.
Do I create a new pull request? I will also add some extra tests to make sure it doesn't happen again

view this post on Zulip Folkert de Vries (Sep 01 2022 at 14:03):

yes, that sounds good!

view this post on Zulip Kilian Vounckx (Sep 01 2022 at 15:38):

Made the pull request!


Last updated: Jul 06 2025 at 12:14 UTC