Skip to content

Commit

Permalink
Binary ↔ ASCII converter: allow spaces between octets
Browse files Browse the repository at this point in the history
Because it is customary to separate the groups of 8 bits by spaces, allow
the input to have spaces, too. Because `parseInt('    01100001  ', 2)` is
the same as `parseInt('01100001', 2)`, this has no effect on the outcome.

Example input: http://pastebin.com/NKbnh8q8
  • Loading branch information
janmoesen committed Feb 16, 2012
1 parent 06d4c34 commit 8b4c3e9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions binary-ascii/eff.js
Expand Up @@ -4,9 +4,9 @@
ascii = textareas[0], ascii = textareas[0],
binary = textareas[1], binary = textareas[1],
permalink = document.getElementById('permalink'), permalink = document.getElementById('permalink'),
regexBinaryGroup = /[01]{8}/g, regexBinaryGroup = /\s*[01]{8}\s*/g,
regexAnyCharacter = /[\s\S]/g, regexAnyCharacter = /[\s\S]/g,
regexBinary = /^([01]{8})*$/, regexBinary = /^(\s*[01]{8}\s*)*$/,
regexExtendedASCII = /^[\x00-\xff]*$/, regexExtendedASCII = /^[\x00-\xff]*$/,
// http://mathiasbynens.be/notes/localstorage-pattern // http://mathiasbynens.be/notes/localstorage-pattern
storage = (function() { storage = (function() {
Expand Down

0 comments on commit 8b4c3e9

Please sign in to comment.