MDN Web Docs @developer.mozilla.org ยท Apr 20

Split text by words and sentences, for any language ๐ŸŒ Intl.Segmenter handles locale-aware text segmentation, including CJK languages where spaces don't separate words. Learn more ๐Ÿ‘‡ developer.mozilla.org/en-US/docs/...

32 likes 2 replies

?

Replies

DDonde ยท Apr 20

Seems very useful!

Greg Potter ยท Apr 20

You can also use this to split strings into user-perceived-characters by using the "grapheme" granularity. This keeps grapheme-clusters, like emoji and surrogate pairs, as single units, unlike using String.prototype.split(""), which splits all characters apart, even if they are part of a cluster.