Skip to content

Commit

Permalink
fix: more fixes for str_sub()
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennebacher authored Dec 26, 2024
1 parent 6bc3a37 commit bf0edbc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion R/funs-string.R
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ pl_str_sub_stringr <- function(string, start, end = NULL) {
when(start_is_zero & end_is_zero)$
then(pl$lit(""))$

when(start_is_zero & (end_is_null | end$abs() > len_string))$
when(start_is_zero & end_is_null)$
then(string)$

when(!start_is_zero & start >= 0 & end < 0 & end$abs() > len_string)$
Expand All @@ -285,6 +285,9 @@ pl_str_sub_stringr <- function(string, start, end = NULL) {
when(start_is_zero & end < 0 & end$abs() <= len_string)$
then(string$str$slice(0, foo6))$

when(start_is_zero & end < 0 & end$abs() > len_string)$
then(pl$lit(""))$

when(start >= 0 & end_is_null)$
then(string$str$slice(start, foo3))$

Expand Down

0 comments on commit bf0edbc

Please sign in to comment.