add PinyinUtil

This commit is contained in:
Looly
2020-04-27 13:45:54 +08:00
parent 63732834ac
commit cf1f208aa0
12 changed files with 467 additions and 144 deletions

View File

@@ -0,0 +1,19 @@
package cn.hutool.extra.pinyin;
import org.junit.Assert;
import org.junit.Test;
public class PinyinUtilTest {
@Test
public void toPinyinTest(){
final String pinyin = PinyinUtil.toPinyin("你好", false);
Assert.assertEquals("ni hao", pinyin);
}
@Test
public void toPinyinUpperCaseTest(){
final String pinyin = PinyinUtil.toPinyin("你好怡", true);
Assert.assertEquals("NI HAO YI", pinyin);
}
}