Last active
August 29, 2015 14:26
-
-
Save JavaScript-Packer/1fcc4323d93837728ad6 to your computer and use it in GitHub Desktop.
Pass any string of characters (binary, ascii, Chinese, etc) and it will return the bytes (formatted like 1,000,000) of characters (not just the character count, some characters are more than one byte). Used on http://www.whak.ca/packer/JavaScript.htm
This file contains hidden or 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
| function bytez(n) { | |
| return n = unescape(encodeURI(n)).length, ("" + n).split(/(?=(?:\d{3})+(?:\.|$))/g).join(","); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment