1 min read

TIL: Incrementing Alphanumerics

Incrementing aphanumerics

Strings have a built in next method.

'1'.next
"2"

'9'.next'
"10"

It works on characters too:

'a'.next
"b"

'z'.next
"aa"

It's cleverer than it looks at first pass too:

'aaz'.next
"aba"

'abc99'.next
"abd01"