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, wait
getFirstLetter, getFirstLetter
public JPinyinEngine()
public JPinyinEngine(com.github.stuxuhai.jpinyin.PinyinFormat format)
public void init(com.github.stuxuhai.jpinyin.PinyinFormat 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.