[pinyin4j] java版汉字转换拼音(大小写)
pinyin4J 是1个可以将汉字转换成拼音的lib,非常实用,其maven地址为:http://mvnrepository.com/artifact/com.belerweb/pinyin4j/2.5.0
pinyin4J 提供PinyinHelper这个静态类对外提供拼音转换的服务,主要有1下方法: static public String[] toHanyuPinyinStringArray(char ch) 将char(必须为汉字单字)转化为拼音,实用的是通用的格式,如果ch为非汉字,返回null。 输入:重 输出:[zhong4,chong2] 说明重字有两个读音,拼音后面的1,2,3,4 代表的是读音
static public String[] toHanyuPinyinStringArray(char ch,HanyuPinyinOutputFormat outputFormat) 同上,但是这个方法可以设置输出的格式。HanyuPinyinOutputFormat 可以设置拼音大小写、是不是后面加读音数字、特殊读音的显示方式,定义以下: /**
* The option indicates that the output of 'ü' is "u:"
*/
public static final HanyuPinyinVCharType WITH_U_AND_COLON = new HanyuPinyinVCharType("WITH_U_AND_COLON");
/**
* The option indicates that the output of 'ü' is "v"
*/
public static final HanyuPinyinVCharType WITH_V = new HanyuPinyinVCharType("WITH_V")
/**
* The option indicates that the output of 'ü' is "ü" in Unicode form
*/
public static final HanyuPinyinVCharType WITH_U_UNICODE = new HanyuPinyinVCharType("WITH_U_UNICODE");
转换为通用拼音。通用拼音的介绍见:http://zh.wikipedia.org/zh-cn/%E9%80%9A%E7%94%A8%E6%8B%BC%E9%9F%B3
static public String[] toWadeGilesPinyinStringArray(char ch) 转换为威妥玛拼音:http://zh.wikipedia.org/wiki/%E5%A8%81%E5%A6%A5%E7%91%AA%E6%8B%BC%E9%9F%B3
static public String[] toMPS2PinyinStringArray(char ch) 转换为注音符号拼音:http://zh.wikipedia.org/zh-cn/%E6%B3%A8%E9%9F%B3%E7%AC%A6%E8%99%9F
static public String[] toYalePinyinStringArray(char ch) 转换为耶 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |