Created
September 1, 2014 09:18
-
-
Save jarontai/76594a9edf5c51d3cba5 to your computer and use it in GitHub Desktop.
calculate the length of string which includes Chinese character
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
| var len = content.match(/[^ -~]/g) == null ? content.length : content.length + content.match(/[^ -~]/g).length; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment