public class HoubbPinyinEngine extends Object implements PinyinEngine
houbb pinyin(https://github.com/houbb/pinyin)封装。
引入:
<dependency> <groupId>com.github.houbb</groupId> <artifactId>pinyin</artifactId> <version>0.2.0</version> </dependency>
Constructor and Description |
---|
HoubbPinyinEngine()
构造
|
HoubbPinyinEngine(com.github.houbb.pinyin.constant.enums.PinyinStyleEnum format)
构造
|
Modifier and Type | Method and Description |
---|---|
String |
getPinyin(char c)
如果c为汉字,则返回大写拼音;如果c不是汉字,则返回String.valueOf(c)
|
String |
getPinyin(String str,
String separator)
获取字符串对应的完整拼音,非中文返回原字符
|
void |
init(com.github.houbb.pinyin.constant.enums.PinyinStyleEnum format)
初始化
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFirstLetter, getFirstLetter
public HoubbPinyinEngine()
public HoubbPinyinEngine(com.github.houbb.pinyin.constant.enums.PinyinStyleEnum format)
format
- 格式public void init(com.github.houbb.pinyin.constant.enums.PinyinStyleEnum format)
format
- 格式public String getPinyin(char c)
PinyinEngine
getPinyin
in interface PinyinEngine
c
- 任意字符,汉字返回拼音,非汉字原样返回public String getPinyin(String str, String separator)
PinyinEngine
getPinyin
in interface PinyinEngine
str
- 字符串separator
- 拼音之间的分隔符Copyright © 2024. All rights reserved.