Created
April 11, 2015 17:03
-
-
Save loon3/a714c7a85abe48d587bd to your computer and use it in GitHub Desktop.
Counterparty Asset Name to Asset ID
This file contains hidden or 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 assetname(assetid) { | |
if(assetid != 1){ | |
var b26_digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
var letter_array = b26_digits.split(""); | |
var asset_name = ""; | |
var div; | |
var rem; | |
while (assetid > 0) { | |
div = Math.floor(assetid/26); | |
rem = assetid % 26; | |
assetid = div; | |
asset_name = asset_name + letter_array[rem]; | |
} | |
var final_name = asset_name.split("").reverse().join(""); | |
} else { | |
var final_name = "XCP"; | |
} | |
return final_name; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Python 3