Java实现汉字转拼音功能,包括 首字母和全拼 for (int j = 0, int len = str.length(); j < len; j++) { char word = str.charAt(j); String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(word); if (pinyinArray != null) { convert += pinyinArray[0].charAt(0);