1
0
mirror of https://github.com/janet-lang/janet synced 2025-11-18 08:15:13 +00:00

Explain the logic behind negative slice indices.

This commit is contained in:
Andrew Chambers
2019-12-03 22:05:43 +13:00
parent fc53445d08
commit a20e956f6d
3 changed files with 8 additions and 3 deletions

View File

@@ -525,7 +525,8 @@ static const JanetReg string_cfuns[] = {
"Returns a substring from a byte sequence. The substring is from "
"index start inclusive to index end exclusive. All indexing "
"is from 0. 'start' and 'end' can also be negative to indicate indexing "
"from the end of the string.")
"from the end of the string. Note that index -1 is synonymous with "
"index (length bytes) to allow a full negative slice range. ")
},
{
"string/repeat", cfun_string_repeat,