中文字 變 拼音,返回首字母

2021-05-17 23:31:56 字數 1577 閱讀 1714

using system;

using system.data;

using system.configuration;

using system.web;

using system.web.security;

using system.web.ui;

using system.web.ui.webcontrols;

using system.web.ui.webcontrols.webparts;

using system.web.ui.htmlcontrols;

using system.collections.generic;

using system.text;

using system.text.regularexpressions;

///

/// hanzi_pinyin 的摘要說明

///

public class hanzi_pinyin

;///

/// 定義陣列

///

private static string pyname = new string

;///

/// 漢字轉換

/// 把漢字轉換成拼音(全拼)

/// 漢字字串

/// 轉換後的拼音(全拼)字串

public static string convert(string hzstring, int maxlength)

", "").replace("^", "").replace("&", "_").replace("=", "").replace("~", "_").replace("@", "_").replace("¥", "");

if (hzstring.length > maxlength)

regex regex = new regex(@"([a-za-z0-9/._]+)", regexoptions.ignorecase);//代表不是中文

if (regex.ismatch(hzstring))

}// 匹配中文字元

regex = new regex("^[/u4e00-/u9fa5]$");

byte array = new byte[2];

string pystring = "";

int chrasc = 0;

int i1 = 0;

int i2 = 0;

char nowchar = hzstring.tochararray();

for (int j = 0; j < nowchar.length; j++)

else}}

}}// 非中文本元

else

}return pystring;

中文轉拼音首字母

使用者商品名稱簡拼搜尋 namespace common business 1.5.66 漢字轉拼音類 class pinyin 中文字串轉拼音首字母 strchangepin 漢字轉拼音的首字母 get first letter 漢字轉拼音 str2py 獲取拼音對應ascll碼 pinyin p...

ORACLE獲取中文字串拼音首字母

oracle漢字轉拼音 獲得全拼 拼音首字母 拼音擷取等 效果如下 oracle 字符集 gbk 沒有問題 utf 8 需要修改一下 sql oracle漢字轉拼音 package 1.獲得全拼 www.2cto.com select gethzpy.gethzfullpy 漢字 from dual...

PHP獲取中文字元拼音首字母

name php獲取中文字元拼音首字母 param str return null string public function getfirstcharter str fchar ord str if fchar ord a fchar ord z s1 iconv utf 8 gb2312 st...