欢迎来到天天文库
浏览记录
ID:37908786
大小:38.50 KB
页数:5页
时间:2019-06-02
《vc中实现获取汉字拼音的首字母》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、在vc中实现获取汉字拼音的首字母默认分类2009-03-0223:15:12阅读192评论0 字号:大中小 订阅Author:lixiaosanDate:05/26/2006/********************************************************************************************/*Syntax/* GetFirstLetter(CStringstrName,CString&strFirstLetter)/*Remarks:/* Getthefirstlettero
2、fpinyinaccordingtospecifiedChinesecharacter./*Parameters:/* strName -aCStringobjectthatistobeparsed./* strFirstLetter -aCStringobjectthatistoreceivethestringofthefirstletter./*ReturnValues:/* None./*Author:/* lixiaosan/*CreateDate:/* 05-26-2006/******
3、**************************************************************************************voidGetFirstLetter(CStringstrName,CString&strFirstLetter){ TBYTEucHigh,ucLow; int nCode; CStringstrRet; strFirstLetter.Empty(); for(inti=0;i4、ame[i]<0x80) continue; ucHigh=(TBYTE)strName[i]; ucLow =(TBYTE)strName[i+1]; if(ucHigh<0xa15、6、ucLow<0xa1) continue; else //Treatcodebysection-positionasaninttypeparameter, //somakefollowingchangetonCode. nCode=(ucHigh-0xa0)*17、00+ucLow-0xa0; FirstLetter(nCode,strRet); strFirstLetter+=strRet; i++; }}/********************************************************************************************/*Syntax/* voidFirstLetter(intnCode,CString&strLetter)/*Remarks:/* Getthefirstletterofpinyin8、accordingtospecifiedChinesecharactercode./*Parameters:/* nCode -thecodeofthechinesecharacter./* strLetter -aCStringobjectthatistoreceivethestringofthefirstletter./*ReturnValues:/* None./*Author:/* lixiaosan/*CreateDate:/* 05-26-2006/********************9、************************************************************************voidFirstLetter(intnCode,CString&strLetter){ if(nCode>=1601&&nCode<1637)strLetter=_T("A"); if(nCode>=1637&&nCode<1833)strLetter=_T("B"); if(nCode>=1833&&nCode<2078)strLetter=_T("C"); if(nCode>=2078&&nCode<227
4、ame[i]<0x80) continue; ucHigh=(TBYTE)strName[i]; ucLow =(TBYTE)strName[i+1]; if(ucHigh<0xa1
5、
6、ucLow<0xa1) continue; else //Treatcodebysection-positionasaninttypeparameter, //somakefollowingchangetonCode. nCode=(ucHigh-0xa0)*1
7、00+ucLow-0xa0; FirstLetter(nCode,strRet); strFirstLetter+=strRet; i++; }}/********************************************************************************************/*Syntax/* voidFirstLetter(intnCode,CString&strLetter)/*Remarks:/* Getthefirstletterofpinyin
8、accordingtospecifiedChinesecharactercode./*Parameters:/* nCode -thecodeofthechinesecharacter./* strLetter -aCStringobjectthatistoreceivethestringofthefirstletter./*ReturnValues:/* None./*Author:/* lixiaosan/*CreateDate:/* 05-26-2006/********************
9、************************************************************************voidFirstLetter(intnCode,CString&strLetter){ if(nCode>=1601&&nCode<1637)strLetter=_T("A"); if(nCode>=1637&&nCode<1833)strLetter=_T("B"); if(nCode>=1833&&nCode<2078)strLetter=_T("C"); if(nCode>=2078&&nCode<227
此文档下载收益归作者所有