Skip to content

Instantly share code, notes, and snippets.

View vicomte's full-sized avatar

Marc Hassman vicomte

  • Scorevision
  • Papillion, NE
View GitHub Profile
@vicomte
vicomte / succ.js
Last active December 21, 2015 15:09 — forked from devongovett/succ.js
/*
* An implementation of Ruby's string.succ method.
* By Devon Govett
*
* Returns the successor to str. The successor is calculated by incrementing characters starting
* from the rightmost alphanumeric (or the rightmost character if there are no alphanumerics) in the
* string. Incrementing a digit always results in another digit, and incrementing a letter results in
* another letter of the same case.
*
* If the increment generates a carry, the character to the left of it is incremented. This