Skip to content

Feature: Get successor string by incrementing characters. #22

@huandu

Description

@huandu

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions