微信小程序 - 获取汉字拼音首字母(汉字英文首字母)

前言

例如 “中国” 的首字母就是 “Z”,我们需要通过代码来自动判断从而得出结果。

本文介绍在小程序中,如何从 0-1 完成。

您可以传入中文字,会自动返回其首字母,可控制大小写。

console.log(pin.getLetter('中国'))// z
console.log(pin.getLetter('韩国')

猜你喜欢

转载自blog.csdn.net/weixin_44198965/article/details/125045805