Skip to content

Instantly share code, notes, and snippets.

@pce
Created December 11, 2011 13:31
Show Gist options
  • Save pce/1460634 to your computer and use it in GitHub Desktop.
Save pce/1460634 to your computer and use it in GitHub Desktop.
ascii map text-format
<script>
function asciimap_decode (s) {
var out = '';
var _r = [];
var count, ascii = 0;
var blocks = s.split('|');
// console.log(blocks);
for (var block in blocks) {
// console.log(blocks[block]);
_r = blocks[block].split(':');
count = _r[0];
ascii = _r[1];
for (i = 0;i < count; i++)
out += String.fromCharCode(ascii);
}
return out;
};
document.write('<pre>');
document.write(asciimap_decode('2:32|1:79|3:45|1:79|1:10|1:32|1:47|1:32|1:92|1:32|1:47|1:32|1:92|1:10|1:79|3:45|1:79|3:45|1:79|1:10|1:32|1:92|1:32|1:47|1:32|1:92|1:32|1:47|1:10|2:32|1:79|3:45|1:79'));
document.write('</pre>');
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment