Skip to content

Instantly share code, notes, and snippets.

@tdg5
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdg5/78a7b7251c33b8543969 to your computer and use it in GitHub Desktop.
Save tdg5/78a7b7251c33b8543969 to your computer and use it in GitHub Desktop.
itoa method
def itoa(int, base = 10)
str = ""
while int > 0
str = ((int % base) + 48).chr + str
int /= base
end
str
end
def itoarr(int, base = 10)
str = []
while int > 0
str.unshift(((int % base) + 48).chr)
int /= base
end
str
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment