vb.net汉字 VB net

vb.net怎么判断一个字符串中是否包含汉字

str = "hello,everybody. " 返回false,位置0。(不含汉字和汉语标点符号)

红岗网站制作公司哪家好,找创新互联!从网页设计、网站建设、微信开发、APP开发、自适应网站建设等网站项目制作,到程序开发,运营维护。创新互联于2013年创立到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联

str = "hello,ererybody。 " 返回false,位置16。(最后一个句号是汉语标点符号)

先谢过大家了!

如何用vb.net将汉字转换成拼音阿

public string hz2py(string hz) //获得汉字的区位码

{

byte[] sarr = System.Text.Encoding.Default.GetBytes(hz);

int len = sarr.Length;

if (len1)

{

byte[] array = new byte[2];

array = System.Text.Encoding.Default.GetBytes(hz);

int i1 = (short)(array[0] - '\0');

int i2 = (short)(array[1] - '\0');

//unicode解码方式下的汉字码

// array = System.Text.Encoding.Unicode.GetBytes(hz);

// int i1 = (short)(array[0] - '\0');

// int i2 = (short)(array[1] - '\0');

// int t1 = Convert.ToInt32(i1,16);

// int t2 = Convert.ToInt32(i2,16);

int tmp=i1*256+i2;

string getpychar="*";//找不到拼音码的用*补位

if(tmp=45217tmp=45252){getpychar= "A";}

else if(tmp=45253tmp=45760){getpychar= "B";}

else if(tmp=47761tmp=46317){getpychar= "C";}

else if(tmp=46318tmp=46825){getpychar= "D";}

else if(tmp=46826tmp=47009){getpychar= "E";}

else if(tmp=47010tmp=47296){getpychar= "F";}

else if(tmp=47297tmp=47613){getpychar= "G";}

else if(tmp=47614tmp=48118){getpychar= "H";}

else if(tmp=48119tmp=49061){getpychar= "J";}

else if(tmp=49062tmp=49323){getpychar= "K";}

else if(tmp=49324tmp=49895){getpychar= "L";}

else if(tmp=49896tmp=50370){getpychar= "M";}

else if(tmp=50371tmp=50613){getpychar= "N";}

else if(tmp=50614tmp=50621){getpychar= "O";}

else if(tmp=50622tmp=50905){getpychar= "P";}

else if(tmp=50906tmp=51386){getpychar= "Q";}

else if(tmp=51387tmp=51445){getpychar= "R";}

else if(tmp=51446tmp=52217){getpychar= "S";}

else if(tmp=52218tmp=52697){getpychar= "T";}

else if(tmp=52698tmp=52979){getpychar= "W";}

else if(tmp=52980tmp=53640){getpychar= "X";}

else if(tmp=53689tmp=54480){getpychar= "Y";}

else if(tmp=54481tmp=55289){getpychar= "Z";}

return getpychar;

}

else

{

return hz;

}

}

public string transpy(string strhz) //把汉字字符串转换成拼音码

{

string strtemp="";

int strlen=strhz.Length;

for (int i=0;i=strlen-1;i++)

{

strtemp+=hz2py(strhz.Substring(i,1));

}

return strtemp;

}

create table tabpy(id int identity,b_begin varbinary(2),b_end varbinary(2),word varchar(2))

insert tabpy select 0xB0A1, 0xB0C4,'A'

union all select 0xB0C5, 0xB2C0,'B'

union all select 0xB2C1, 0xB4ED,'C'

union all select 0xB4EE, 0xB6E9,'D'

union all select 0xB6EA, 0xB7A1,'E'

union all select 0xB7A2, 0xB8C0,'F'

union all select 0xB8C1, 0xB9FD,'G'

union all select 0xB9FE, 0xBBF6,'H'

union all select 0xBBF7, 0xBFA5,'J'

union all select 0xBFA6, 0xC0AB,'K'

union all select 0xC0AC, 0xC2E7,'L'

union all select 0xC2E8, 0xC4C2,'M'

union all select 0xC4C3, 0xC5B5,'N'

union all select 0xC5B6, 0xC5BD,'O'

union all select 0xC5BE, 0xC6D9,'P'

union all select 0xC6DA, 0xC8BA,'Q'

union all select 0xC8BB, 0xC8F5,'R'

union all select 0xC8F6, 0xCBF9,'S'

union all select 0xCBFA, 0xCDD9,'T'

union all select 0xCDDA, 0xCEF3,'W'

union all select 0xCEF4, 0xD1B8,'X'

union all select 0xD1B9, 0xD4D0,'Y'

union all select 0xD4D1, 0xD7F9,'Z'

函数:

create function getfirstpy(@a varchar(200))

returns varchar(100)

as

begin

declare @i int,@j int,@result varchar(100)

set @result=''

set @i=len(@a)

set @j=1

while @j=@i

begin

select @result=@result+word from tabpy where cast(substring(@a,@j,1) as varbinary(2)) between b_begin and b_end

set @j=@j+1

end

return @result

end

VB.NET中怎么实现 汉字转换拼音呢

建立一个表,每个拼音都跟多个汉字对应。可以通过汉字,找出对应的一个拼音,也可以通过拼音,找出一堆汉字。

VB.net做软键盘输入中文汉字,请问在VB.net不是VB6中.怎么做软键盘输入汉字.我现在能输入英文但是汉字不行

既然你可以输入英文,只要系统切换到中文输入方式下,例如“谷歌拼音”,不就可以输入中文了

VB.net有什么函数能统计“汉字、全角字符”这些占用两个字节的数量?

VB使用Unicode编码,任何字符(包括半角的字母、数字、符号及全角的汉字、符号等)都是占用两个字节的。

Len()

函数返回字符串的字符个数(要注意,一个汉字也是算作一个字符的)

比如:

Len("百度baidu")的返回值为7

LenB()

函数返回字符串的占用字节数

比如:

LenB("百度baidu")的返回值为14

网站题目:vb.net汉字 VB net
文章地址:https://www.cdcxhl.com/article34/doddpse.html

成都网站建设公司_创新互联,为您提供网站设计公司网站策划Google响应式网站手机网站建设

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

绵阳服务器托管