public class TinyPinyinEngine extends Object implements PinyinEngine
TinyPinyin(https://github.com/promeG/TinyPinyin)提供者未提交Maven中央库,
因此使用
https://github.com/biezhi/TinyPinyin打包的版本
引入:
<dependency> <groupId>io.github.biezhi</groupId> <artifactId>TinyPinyin</artifactId> <version>2.0.3.RELEASE</version> </dependency>
Constructor and Description |
---|
TinyPinyinEngine()
构造
|
TinyPinyinEngine(com.github.promeg.pinyinhelper.Pinyin.Config config)
构造
|
Modifier and Type | Method and Description |
---|---|
String |
getPinyin(char c)
如果c为汉字,则返回大写拼音;如果c不是汉字,则返回String.valueOf(c)
|
String |
getPinyin(String str,
String separator)
获取字符串对应的完整拼音,非中文返回原字符
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFirstLetter, getFirstLetter
public TinyPinyinEngine()
public TinyPinyinEngine(com.github.promeg.pinyinhelper.Pinyin.Config config)
config
- 配置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.