cn.hutool.extra.pinyin.engine.bopomofo4j.Bopomofo4jEngine Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hutool-all Show documentation
Show all versions of hutool-all Show documentation
Hutool是一个小而全的Java工具类库,通过静态方法封装,降低相关API的学习成本,提高工作效率,使Java拥有函数式语言般的优雅,让Java语言也可以“甜甜的”。
package cn.hutool.extra.pinyin.engine.bopomofo4j;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.pinyin.PinyinEngine;
import com.rnkrsoft.bopomofo4j.Bopomofo4j;
import com.rnkrsoft.bopomofo4j.ToneType;
/**
* 封装了Bopomofo4j的引擎。
*
*
* Bopomofo4j封装,项目:https://gitee.com/rnkrsoft/Bopomofo4j。
*
*
*
* 引入:
*
* <dependency>
* <groupId>com.rnkrsoft.bopomofo4j</groupId>
* <artifactId>bopomofo4j</artifactId>
* <version>1.0.0</version>
* </dependency>
*
*
* @author looly
* @since 5.4.5
*/
public class Bopomofo4jEngine implements PinyinEngine {
public Bopomofo4jEngine(){
Bopomofo4j.local();
}
@Override
public String getPinyin(char c) {
return Bopomofo4j.pinyin(String.valueOf(c), ToneType.WITHOUT_TONE, false, false, StrUtil.EMPTY);
}
@Override
public String getPinyin(String str, String separator) {
return Bopomofo4j.pinyin(str, ToneType.WITHOUT_TONE, false, false, separator);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy