Skip to content

Commit

Permalink
[stdlib] Use assert() insted of when() in before_first()
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyash-b committed Dec 23, 2024
1 parent 96b9e56 commit eff7b30
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/stdlib.ngs
Original file line number Diff line number Diff line change
Expand Up @@ -4799,7 +4799,7 @@ section "Strings and characters" {
doc Split the string by delimiter and return the last part
doc %RET - Str
F before_first(s:Str, delim:Str) {
p = s.pos(delim).when(Null, { throw InvalidArgument("Delimiter not found in before_first()").set(val=s, delim=delim) })
p = s.pos(delim).assert(Not(null), InvalidArgument("Delimiter not found in before_first()").set(val=s, delim=delim))
s[0..p]
}

Expand Down

0 comments on commit eff7b30

Please sign in to comment.