Skip to content

Instantly share code, notes, and snippets.

@zetashift
Created February 25, 2018 06:06
Show Gist options
  • Save zetashift/31b8ec0aed2fc47b0e723b925a5cb50a to your computer and use it in GitHub Desktop.
Save zetashift/31b8ec0aed2fc47b0e723b925a5cb50a to your computer and use it in GitHub Desktop.
DailyProgrammer #352 [EASY]
const
alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
proc base62(input: int): string =
result = ""
var q = input
while q != 0:
var i = q mod 62
q = q div 62
result = result & alphabet[i]
echo(base62(187621)) #90M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment