Created
August 23, 2018 20:20
-
-
Save lokeb/b81fc9285122a00ec6ecb05aa4e5d72a to your computer and use it in GitHub Desktop.
Parse currency symbols from https://www.xe.com/symbols.php into a csv string
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
var tdr = $('table')[0].children[0].children; | |
var out = ''; | |
$.each(tdr, (c, el) => { | |
const els = el.children; | |
var curr = ''; | |
var ucs = els[6].textContent.trim(); | |
if(ucs.length) { | |
ucs = ucs.split(","); | |
for(var i = 0; i < ucs.length; i++) { | |
curr += (c > 0 ? '\\u' : '') + ucs[i].trim().padStart("4", "0"); | |
} | |
} | |
var templ = `"${els[0].textContent}", "${els[1].textContent}", "${curr}"`; | |
out += templ + "\n"; | |
}) | |
console.log(out); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment