mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
Fixed algorithm problem in Str.split, that would drop the final str in the return list if it was empty
This commit is contained in:
parent
7b488d0970
commit
a3720e6c3d
2 changed files with 64 additions and 25 deletions
|
@ -133,7 +133,7 @@ pub fn strSplitInPlace(
|
|||
var str_index : usize = 0;
|
||||
|
||||
if (str_len > delimiter_len) {
|
||||
const end_index : usize = str_len - delimiter_len;
|
||||
const end_index : usize = str_len - delimiter_len + 1;
|
||||
while (str_index <= end_index) {
|
||||
var delimiter_index : usize = 0;
|
||||
var matches_delimiter = true;
|
||||
|
@ -301,7 +301,7 @@ pub fn countSegments(
|
|||
|
||||
if (str_len > delimiter_len) {
|
||||
var str_index: usize = 0;
|
||||
const end_cond: usize = str_len - delimiter_len;
|
||||
const end_cond: usize = str_len - delimiter_len + 1;
|
||||
|
||||
while (str_index < end_cond) {
|
||||
var delimiter_index: usize = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue