Created
April 3, 2012 14:07
-
-
Save phiggins42/2292270 to your computer and use it in GitHub Desktop.
A handy way to convert your dollar values to an unreadable base 16 variant.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function zero(n){ | |
n = n.length == 1 ? n + "0" : n; | |
return +n; | |
} | |
function dollarsToHex(total){ | |
var parts = total.toString(10).split("."); | |
return parts.map(function(part){ | |
return zero(part).toString(16); | |
}).join("."); | |
} | |
function hexToDollars(hex){ | |
var parts = hex.split("."); | |
return parts.map(function(part){ | |
return parseInt(part, 16); | |
}).join("."); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(for writing checks. eg: "two hundred and fifty five and 50/100" but in the box you put "$ff.32" ...)