redex
redex copied to clipboard
Add CHOP command to rxstrings
Note that tests for this module will fail until this redis pull request is merged.
CHOP key count
Removes characters from a value to a String key. If 'count' is positive or zero, it removes from the right of the string; if 'count' is negative, it removes from the left of the string. If |count| is greater than the string length, the value is set as an empty string. It is an error if the value is not a String. Integer Reply: the length of the string after the chop operation.
@neomantra nice and useful, thanks! Looks good by a cursory glace so I plan to merge this.
I'll keep this open for now until I revisit the redex modules in the near future to make them Redis v4 ready.
I just updated this for the released Redis 4.0.0. All tests pass.
Don't merge this yet? I'm exploring the generalized form discussed in #12