mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2025-01-19 17:46:46 +02:00
Document builtins.substring negative length behavior (#9226)
This commit is contained in:
parent
abb1c829c8
commit
f269911641
1 changed files with 5 additions and 4 deletions
|
@ -3720,10 +3720,11 @@ static RegisterPrimOp primop_substring({
|
||||||
.doc = R"(
|
.doc = R"(
|
||||||
Return the substring of *s* from character position *start*
|
Return the substring of *s* from character position *start*
|
||||||
(zero-based) up to but not including *start + len*. If *start* is
|
(zero-based) up to but not including *start + len*. If *start* is
|
||||||
greater than the length of the string, an empty string is returned,
|
greater than the length of the string, an empty string is returned.
|
||||||
and if *start + len* lies beyond the end of the string, only the
|
If *start + len* lies beyond the end of the string or *len* is `-1`,
|
||||||
substring up to the end of the string is returned. *start* must be
|
only the substring up to the end of the string is returned.
|
||||||
non-negative. For example,
|
*start* must be non-negative.
|
||||||
|
For example,
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
builtins.substring 0 3 "nixos"
|
builtins.substring 0 3 "nixos"
|
||||||
|
|
Loading…
Reference in a new issue