Skip to content

Commit

Permalink
Merge pull request #12177 from NixOS/mergify/bp/2.25-maintenance/pr-1…
Browse files Browse the repository at this point in the history
…2114

fix documentation of substring (backport #12114)
  • Loading branch information
mergify[bot] authored Jan 10, 2025
2 parents 70ab8bb + d54c283 commit 7a7a3d2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libexpr/primops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4061,7 +4061,7 @@ static RegisterPrimOp primop_toString({
});

/* `substring start len str' returns the substring of `str' starting
at character position `min(start, stringLength str)' inclusive and
at byte position `min(start, stringLength str)' inclusive and
ending at `min(start + len, stringLength str)'. `start' must be
non-negative. */
static void prim_substring(EvalState & state, const PosIdx pos, Value * * args, Value & v)
Expand Down Expand Up @@ -4100,7 +4100,7 @@ static RegisterPrimOp primop_substring({
.name = "__substring",
.args = {"start", "len", "s"},
.doc = R"(
Return the substring of *s* from character position *start*
Return the substring of *s* from byte position *start*
(zero-based) up to but not including *start + len*. If *start* is
greater than the length of the string, an empty string is returned.
If *start + len* lies beyond the end of the string or *len* is `-1`,
Expand Down

0 comments on commit 7a7a3d2

Please sign in to comment.