Skip to content

zhylmzr/word-pinyin

Repository files navigation

word-pinyin

Build Status npm size download

Node端汉字转拼音库, 针对小程序设计, 不支持多音字

用法

直接复制 word-pinyin.d.ts, word-pinyin.js 文件

或者

yarn add word-pinyin

例子

import PinYin from "word-pinyin";

PinYin.getPinyin("你好骚啊") // ni hao sao a
PinYin.getFirstLetter("你好骚啊") // NHSA

方法

getPinyin(chinese: string, splitter: string = ' ') 获取汉字的拼音

  • cinese: 汉字
  • splitter: 字与字之间的分隔符

getFirstLetter(str: string) 获取汉字的拼音首字母

  • str: 汉字

感谢

About

汉字转拼音

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published