redex icon indicating copy to clipboard operation
redex copied to clipboard

Add CHOP command to rxstrings

Open neomantra opened this issue 8 years ago • 3 comments

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 avatar Dec 29 '16 20:12 neomantra

@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.

itamarhaber avatar Dec 29 '16 21:12 itamarhaber

I just updated this for the released Redis 4.0.0. All tests pass.

neomantra avatar Jul 17 '17 04:07 neomantra

Don't merge this yet? I'm exploring the generalized form discussed in #12

neomantra avatar Jul 17 '17 14:07 neomantra