spoike
9/24/2013 - 1:43 PM

For determining which character to take from an ascii table using row and column indices.

For determining which character to take from an ascii table using row and column indices.

var toAsciiIndex = function(str) {
  var i, carr = [], curr;
  for(i = 0; i < str.length; i++) {
    curr = str.charCodeAt(i);
    carr.push([curr%32, Math.floor(curr/32)]);
  }
  return carr;
};

toAsciiIndex("Hah"); // -> [[8,2],[1,3],[8,3]]