Skip to content

Instantly share code, notes, and snippets.

@quickredfox
Created March 4, 2013 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quickredfox/5084870 to your computer and use it in GitHub Desktop.
Save quickredfox/5084870 to your computer and use it in GitHub Desktop.
Split a javascript utf-16 string into an array of graphemes.
var splitGraphemes = function( string ) {
var matches = string.match( /([A-Z]{1})|([^A-Z]{2})|([^A-Z]{1})/gi );
if( !matches) return [];
return Array.prototype.slice.call( matches );
}
@quickredfox
Copy link
Author

Note: This is context specific, YMMV.

@quickredfox
Copy link
Author

Actually, no. It's crap. Dont use this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment