cfunction
src/core/string.c on line 173 , column 1
(string/slice bytes &opt start end )
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. Note that if `start` is negative it is
exclusive , and if `end` is negative it is inclusive , to allow a
full negative slice range.
(string/slice "hello" ) # => "hello"
(string/slice "hello" 0 ) # => "hello"
(string/slice "hello" 1 ) # => "ello"
(string/slice "hello" 4 ) # => "o"
(string/slice "hello" 5 ) # => ""
(string/slice "hello" -1 ) # => ""
(string/slice "hello" -2 ) # => "o"
(string/slice "hello" -5 ) # => "ello"
(string/slice "hello" -6 ) # => "hello"
(string/slice "hello" 1 1 ) # => ""
(string/slice "hello" 1 2 ) # => "e"
(string/slice "hello" 1 5 ) # => "ello"
(string/slice "hello" -5 -4 ) # => "e"
(string/slice "hello" -6 -4 ) # => "he"
(string/slice "hello" 2 1 ) # => ""
(string/slice "hello" -1 -2 ) # => ""