In my application I use sequences. These are stored in Azure table storage as strings. To update the sequence I get the latest number as a string, convert to a number, add to the number and store it back as the current sequence value. The sequences are used internally as unique keys but they are also visible in URLs to the user so I would like to keep them short.
What I am considering is the idea of having a sequence in base36. In other words 0-Z. Does anyone have any idea how I can get a sequence that is stored as a 4 digit string starting with "0000" and then add one to it to give "0001" right through to "ZZZZ" as the last possible value of the sequence.
This should do it: