Open Shimizusorrow opened 3 years ago
/** * 将中文转换为拼音 */ @Test void test() throws BadHanyuPinyinOutputFormatCombination { HanyuPinyinOutputFormat format=new HanyuPinyinOutputFormat(); format.setToneType(HanyuPinyinToneType.WITHOUT_TONE); // format.setCaseType(HanyuPinyinCaseType.UPPERCASE); // format.setVCharType(HanyuPinyinVCharType.WITH_V); String[] strings = PinyinHelper.toHanyuPinyinStringArray('华', format); System.out.println(String.join("",strings)); }
output:
huahuahua
三个读音有不同的声调, 但是你没要声调。
output: