獲取漢字的拼音首字母 pinyin

2022-03-13 06:03:09 字數 787 閱讀 9546

var pinyin = (function (),

options = ;

pinyin.fn = pinyin.prototype = ,

// 提取拼音, 返回首字母大寫形式

getfullchars: function(str)else}}

return result;

},// 提取首字母,返回大寫形式

getcamelchars: function(str)

//處理arrresult,返回所有可能的拼音首字母串陣列

return this._getresult(chars);

},// 提取拼音

_getfullchar: function(str)

}return false;

},// 首字母大寫

_capitalize: function(str)

},_getchar: function(ch),

_getresult: function(chars)

return dst;

};return new pinyin(arguments);

})();

//上面是拼音js

pinyin.getcamelchars("測試");

console.log(pinyin.getcamelchars("測試").charat(0))

console.log(pinyin.getfullchars("測試"))

console.log(pinyin._capitalize("測試"))

獲取漢字拼音首字母

有個專案需要用到生成漢字的首字母,但從網上查了一下,對於多音字的處理都不是很好,所以就利用pinyin4j這個工具包自己寫了乙個。用到的jar包是pinyin4j 2.5.0.jar 獲取拼音首字母,多音字用逗號隔開 public static string getfirstspell string...

獲取漢字拼音首字母

unit py inte ce uses sysutils 獲取漢字的拼音首字元,這個函式將用在getpyindexstr 中.function getpyindexchar strchinese string bupcase boolean true char 獲取多個漢字的拼音首字元組成的字串....

獲取漢字拼音首字母

獲取漢字拼音首字母 獲取漢字拼音首字母 很好用.覺的不錯的幫頂 1.下面的不上亂碼是位元組 第一步建立乙個函式 create or replace function f trans pinyin capital p name in varchar2 return varchar2 as v comp...