GETRANGE key start end
Warning: this command was renamed to GETRANGE, it is called
SUBSTR in Redis versions
Returns the substring of the string value stored at
key, determined by the offsets
end (both are inclusive). Negative offsets can be used in order to provide an offset starting from the end of the string. So -1 means the last character, -2 the penultimate and so forth.
The function handles out of range requests by limiting the resulting range to the actual length of the string.
"OK"redis> GETRANGE mykey 0 3
"This"redis> GETRANGE mykey -3 -1
"ing"redis> GETRANGE mykey 0 -1
"This is a string"redis> GETRANGE mykey 10 100
© 2009–2017 Salvatore Sanfilippo
Licensed under the Creative Commons Attribution-ShareAlike License 4.0.