Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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

Feature: Get successor string by incrementing characters. #22

Closed
huandu opened this issue Jan 8, 2015 · 1 comment
Closed

Feature: Get successor string by incrementing characters. #22

huandu opened this issue Jan 8, 2015 · 1 comment

Comments

@huandu
Copy link
Owner

huandu commented Jan 8, 2015

See String#next in ruby.

Ruby document doesn't define the algorithm in String#next clearly. Here is my version (may not be 100% same as ruby).

Alphanumeric runes are following.

  • a - z
  • A - Z
  • 0 - 9

If there is one alphanumeric rune is found in string, increase the rune by 1. If increment generates a "carry", the rune to the left of it is incremented. This process repeats until there is no carry, adding an additional rune if necessary.

If there is no alphanumeric rune, the rightmost rune will be increased by 1 regardless whether the result is a valid rune or not.

@huandu
Copy link
Owner Author

huandu commented Jan 9, 2015

New api: Successor.

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

No branches or pull requests

1 participant