1取汉字汉语拼音首字母: private static string GetFirstLetterOfChineseString(string CnChar) { long iCnChar; byte[] ZW = System.Text.Encoding.Default.GetBytes(CnChar); //如果是字母,则直接返回 if (ZW.Length == 1) { return CnChar.ToUpper(); } else { int i1 = (short)(ZW[0]);…
使用类库为 https://gitee.com/kuiyu/dotnetcodes/tree/master/DotNet.Utilities/%E6%B1%89%E5%AD%97%E8%BD%AC%E6%8B%BC%E9%9F%B3 取首字母 textBox2.Text = PinYin.GetCodstring(textBox1.Text); 取汉字全拼 EcanConvertToCh toCh = new EcanConvertToCh(); textBox3.Text = toCh.con…
有时候,可能会有一些类似这样的需求: 对于这样的效果,我们可以有类似这样的解决方案: package bys.utils; import java.io.UnsupportedEncodingException; /** * Created by toutou on 2014/2/21 */ public class ChineseCharacterHelper { static final int GB_SP_DIFF = 160; // 存放国标一级汉字不同读音的起始区位码 static f…
)) ) --用于加密 --WITH ENCRYPTION as begin declare @intLen int ) ) set @intLen = len(@str) set @strRet = '' begin set @temp = '' select @temp = case ) >= '帀' then 'Z' ) >= '丫' then 'Y' ) >= '夕' then 'X' ) >= '屲' then 'W' ) >= '他' then 'T' ) >…
--创建取汉字首字母函数(第三版) create function [dbo].[f_getpy_V3] ( ) ) ) as begin ),) ,@len = len(@col),@sql = '' while @cyc <= @len begin ) as varbinary) ),ecode ),letter )) insert into @maco select 0XB0A1,0XB0C4,'A' union all select 0XB0C5,0XB2C0,'B' union all…
将汉字转为全拼,提取汉字首字母 <?php /** * 基于PHP语言的汉语转拼音的类 * 兼容 UTF8.GBK.GB2312 编码,无须特殊处理 * 对中文默认返回拼音首字母缩写,其它字符不作处理直接返回. * */ class py_class{ /** * 汉字拼音对照数组 * * @var array */ var $pinyin = array(); /** * 构造函数 * * @return py_class */ function py_class(){ $this->pin…
--获取全拼 DECLARE @str VARCHAR(max) SET @str= [dbo].[fn_Getquanpin]('中山') PRINT(@str) )) ) as begin ),) declare @strlen int select @strlen=len(@str),@re='' begin ) select @re= case when @crs<'吖' then @crs when @crs<='厑' then 'a' when @crs<='靉' then…
//获取 汉字首字母 function makePy(str) { if (typeof (str) != "string") throw new Error(-1, "函数makePy需要字符串类型参数!"); var arrResult = new Array(); for (var i = 0, len = str.length; i < len; i++) { var ch = str.charAt(i); arrResult.push(checkCh…
/// <summary> /// 获取汉字首字母(可包含多个汉字) /// </summary> /// <param name="strText"></param> /// <returns></returns> public string GetChineseSpell(string strText) { int len = strText.Length; string myStr = ""…
php获取汉字首字母,可以用于按字母对数据进行检索排序等. 分享下网上找的代码.亲测有效. function getFirstCharter($str){ if(empty($str)){return '';} $fchar=ord($str{0}); if($fchar>=ord('A')&&$fchar<=ord('z')) return strtoupper($str{0}); $s1=iconv('UTF-8','gb2312',$str); $s2=iconv('gb…