newStr = splitGraphemes(str)
splits the string str into graphemes. A grapheme (also known as grapheme
cluster) is the Unicode term for human-perceived characters.
Split text into graphemes using the splitGraphemes function.
A grapheme (also known as grapheme clusters) is the Unicode term for human-perceived characters. Some graphemes contain multiple code units. For example, the "smiling face with sunglasses" emoji (😎 with code point U+1F60E) is a single grapheme but comprises two UTF16 code units "D83D" and "DE0E".
str — Input text string array | character vector | cell array of character vectors
Input text, specified as a string array, character vector, or cell array of
character vectors. For string array and cell array input, each element of
str must have the same number of graphemes.
If the number of graphemes is not the same for every element of
str, then call the function in a for-loop to split the elements
of str one at a time.
newStr — Split graphemes string array | cell array of character vectors
Split graphemes, returned as a string array or a cell array of character vectors. If
str is a string array, then newStr is also a
string array. Otherwise, newStr is a cell array of character
vectors.
The size of newStr depends on the input:
If str is a string scalar or a character vector, then
newStr is an numGraphemes-by-1 string
array or cell array, where numGraphemes is the number of
graphemes.
If str is an M-by-1 string array or
cell array, then newStr is a
M-by-numGraphemes array.
If str is a 1-by-N string array or
cell array, then newStr is a
1-by-N-by-numGraphemes array.
For a string array or cell array of any size, the function orients the
split graphemes along the first trailing dimension with size 1.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.