Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CHOP command to rxstrings #10

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

neomantra
Copy link
Contributor

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.

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.
@itamarhaber
Copy link
Contributor

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

Since Redis 4 was released without redis/redis#3718
this change was required to make CHOP work properly with Redis 4.0.0.

Now all tests pass on stock Redis 4.0.0.
@neomantra
Copy link
Contributor Author

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

@itamarhaber itamarhaber mentioned this pull request Jul 17, 2017
@neomantra
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants