Skip to content

Instantly share code, notes, and snippets.

@celeen
Created August 8, 2015 17:55
Show Gist options
  • Save celeen/44cc97c305f4a7005637 to your computer and use it in GitHub Desktop.
Save celeen/44cc97c305f4a7005637 to your computer and use it in GitHub Desktop.
separate_number refactor for Phil
def separate_comma(num)
string = num.to_s #turn integer into string
z = -4
while z > -(string.length+1)
string.insert(z, ",")
z -= 4
end
string
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment