To get chinese pinyin or alphabet from chinese. 从汉字提取拼音,返回首字母大写形式;提取首字母,返回大写形式。
IE / Edge |
Firefox |
Chrome |
Safari |
iOS Safari |
Opera |
---|---|---|---|---|---|
IE8+ Edge+ | last 10 versions | last 10 versions | last 2 versions | last 2 versions | last 2 versions |
npm i chinese-alphabetize -S
or
yarn add chinese-alphabetize
import Alphabetize, { getFullChars, getCamelChars } from 'chinese-alphabetize'
or
const Alphabetize, { getFullChars, getCamelChars } = require('chinese-alphabetize')
. getFullChars(提取拼音,返回首字母大写形式)
<
Alphabetize.getFullChars('张三')
->
ZhangSan
. getCamelChars(提取首字母,返回大写形式)
<
Alphabetize.getCamelChars('张三铅')
Alphabetize.getCamelChars('张三铅', { checkPolyphone: true })
->
ZSQ
['ZSQ', 'ZSY']