java漢字取拼音

2021-06-01 10:38:30 字數 1097 閱讀 2673

package info.util;

import net.sourceforge.pinyin4j.pinyinhelper;

import net.sourceforge.pinyin4j.format.hanyupinyincasetype;

import net.sourceforge.pinyin4j.format.hanyupinyinoutputformat;

import net.sourceforge.pinyin4j.format.hanyupinyintonetype;

import net.sourceforge.pinyin4j.format.hanyupinyinvchartype;

import net.sourceforge.pinyin4j.format.exception.badhanyupinyinoutputformatcombination;

import org.apache.log4j.logger;

public class pyhelper

public static string getfirstleter(string str, stringbuilder sb)

if (sb == null)

char chars = str.tochararray();

if (chars != null && chars.length > 0)

} catch (badhanyupinyinoutputformatcombination e)

}} return sb.tostring();

} public static string getallleter(string str, stringbuilder sb)

if (sb == null)

char chars = str.tochararray();

if (chars != null && chars.length > 0)

} catch (badhanyupinyinoutputformatcombination e)

}} return sb.tostring();

}}

易語言 取漢字拼音

版本 2 支援庫 spec 子程式 按鈕1 被單擊 區域性變數 wjh,整數型 區域性變數 a,文字型 區域性變數 b,文字型,0 區域性變數 b2,文字型 區域性變數 c,文字型 區域性變數 i,整數型 wjh 開啟檔案 c users desktop 中文.txt 除錯輸出 wjh 判斷迴圈首 ...

JAVA漢字轉拼音

工作原因,需要將中文轉成拼音放置到資料庫的字段中,以供搜尋使用.下面放上 以及說明.見面是具體 mport net.sourceforge.pinyin4j.pinyinhelper import net.sourceforge.pinyin4j.format.import net.sourcefo...

Java把漢字轉拼音

pingyin4j.jar 漢字轉換位漢語拼音,英文本元不變 author xuke public class cn2spell catch badhanyupinyinoutputformatcombination e else return pinyinname 漢字轉換位漢語拼音,英文本元不變...