public class JPinyinEngine extends Object implements PinyinEngine
jpinyin(github库作者已删除)封装。
引入:
<dependency>
<groupId>com.github.stuxuhai</groupId>
<artifactId>jpinyin</artifactId>
<version>1.1.8</version>
</dependency>
| Constructor and Description |
|---|
JPinyinEngine()
构造
|
JPinyinEngine(com.github.stuxuhai.jpinyin.PinyinFormat 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.stuxuhai.jpinyin.PinyinFormat format)
初始化格式
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetFirstLetter, getFirstLetterpublic JPinyinEngine()
public JPinyinEngine(com.github.stuxuhai.jpinyin.PinyinFormat format)
format - PinyinFormatpublic void init(com.github.stuxuhai.jpinyin.PinyinFormat format)
format - 格式PinyinFormatpublic String getPinyin(char c)
PinyinEnginegetPinyin in interface PinyinEnginec - 任意字符,汉字返回拼音,非汉字原样返回public String getPinyin(String str, String separator)
PinyinEnginegetPinyin in interface PinyinEnginestr - 字符串separator - 拼音之间的分隔符Copyright © 2025. All rights reserved.