Fabric.js graphemeSplit() 方法
graphemeSplit() 方法用于将指定字符串划分为用户感知的单个单元,即指定字符串的每个字符都将转换为字符串的单个单元。
句法:
graphemeSplit(textstring)
参数:此方法接受上面提到的参数,如下所述:
- textstring:此参数保存要分割的字符串。
返回值:此方法返回包含作为分割字符的字素的数组。
示例 1:
Javascript
Javascript
输出:
["G","F","G"]
["G"," ","F"," ","G"]
示例 2:
Javascript
输出:
Using graphemeSplit() Function:
["1","2","a","b"]
Without using graphemeSplit() Function:
12ab