Skip to content

Instantly share code, notes, and snippets.

@lokeb
Created August 23, 2018 20:20
Show Gist options
  • Save lokeb/b81fc9285122a00ec6ecb05aa4e5d72a to your computer and use it in GitHub Desktop.
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
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