# stringToArray
# Description
将 string
转换为 数组
# Params
{String} string
# Return
Array
# Depend
import asciiToArray from './asciiToArray.js'
import hasUnicode from './hasUnicode.js'
import unicodeToArray from './unicodeToArray.js'
# Code
function stringToArray(string) {
return hasUnicode(string)
? unicodeToArray(string)
: asciiToArray(string)
}
# Analyze
判断 string
是否含有 unicode
码,如果有调用 unicodeToArray
否则调用 asciiToArray
(string.split
)
# Remark
# Example
stringToArray('1,2,3,4') // asciiToArray ['1', '2', '3', '4']
stringToArray('笑脸😊') // unicodeToArray [ '笑', '脸', '😊']