JS将中文转化为拼音首字母字符串的小插件
C2Pin
JS将中文转化为拼音首字母字符串的小插件
InstallationDirect download
Download the script here and include it (unless you are packaging scripts somehow else):
<script src="/path/to/c2pin/index.js"></script>
Package Managers
C2Pin supports npm and Bower under the name c2pin
Import the library
import C2Pin from 'c2pin'
Transfer Chinese to Pinyin with first letter
C2Pin.firstChar()
Transfer Chinese to Pinyin with full letter
C2Pin.fullChar()
If there is any danger of a conflict with the namespace C2Pin, the noConflict method will allow you to define a new namespace and preserve the original one.
// Assign the C2Pin api to a different variable and restore the original "window.C2Pin"
var C2PinCopy = C2Pin.noConflict();
C2Pin.firstChar();
版权声明:
1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。2、网站不提供资料下载,如需下载请到原作者页面进行下载。