最好有 c++ builder 的源代码,以前看到过 Delphi 有关于这方面的回答,但小弟 c++ builder 是刚开始学的菜鸟,Delphi 从没用过,希望各位大哥多多帮忙。
小弟的信箱:xuaijin@163.net
很急啊!!!
16 个解决方案
#1
把下面的代码翻译成BCB吧。
// 获取指定汉字的拼音索引字母,如:“汉”的索引字母是“H”
//用来获取汉字的拼音的一个小程序(含源码),但是不能区别多音字
function GetPYIndexChar( hzchar:string):char;
begin
case WORD(hzchar[1]) shl 8 + WORD(hzchar[2]) of
$B0A1..$B0C4 : result := 'A';
$B0C5..$B2C0 : result := 'B';
$B2C1..$B4ED : result := 'C';
$B4EE..$B6E9 : result := 'D';
$B6EA..$B7A1 : result := 'E';
$B7A2..$B8C0 : result := 'F';
$B8C1..$B9FD : result := 'G';
$B9FE..$BBF6 : result := 'H';
$BBF7..$BFA5 : result := 'J';
$BFA6..$C0AB : result := 'K';
$C0AC..$C2E7 : result := 'L';
$C2E8..$C4C2 : result := 'M';
$C4C3..$C5B5 : result := 'N';
$C5B6..$C5BD : result := 'O';
$C5BE..$C6D9 : result := 'P';
$C6DA..$C8BA : result := 'Q';
$C8BB..$C8F5 : result := 'R';
$C8F6..$CBF9 : result := 'S';
$CBFA..$CDD9 : result := 'T';
$CDDA..$CEF3 : result := 'W';
$CEF4..$D188 : result := 'X';
$D1B9..$D4D0 : result := 'Y';
$D4D1..$D7F9 : result := 'Z';
else
result := char(32);
end;
end;
procedure TMainForm.btnConvertClick(Sender: TObject);
var
I: Integer;
PY: string;
s: string;
begin
s := '' ;
for I := 1 to Length(ChineseEdt.Text) div 2 do
begin
PY := Copy(ChineseEdt.Text, I * 2 - 1, 2);
s := s + GetPYIndexChar(PY);
end;
PYEdt.Text := s;
end;
end.
// 获取指定汉字的拼音索引字母,如:“汉”的索引字母是“H”
//用来获取汉字的拼音的一个小程序(含源码),但是不能区别多音字
function GetPYIndexChar( hzchar:string):char;
begin
case WORD(hzchar[1]) shl 8 + WORD(hzchar[2]) of
$B0A1..$B0C4 : result := 'A';
$B0C5..$B2C0 : result := 'B';
$B2C1..$B4ED : result := 'C';
$B4EE..$B6E9 : result := 'D';
$B6EA..$B7A1 : result := 'E';
$B7A2..$B8C0 : result := 'F';
$B8C1..$B9FD : result := 'G';
$B9FE..$BBF6 : result := 'H';
$BBF7..$BFA5 : result := 'J';
$BFA6..$C0AB : result := 'K';
$C0AC..$C2E7 : result := 'L';
$C2E8..$C4C2 : result := 'M';
$C4C3..$C5B5 : result := 'N';
$C5B6..$C5BD : result := 'O';
$C5BE..$C6D9 : result := 'P';
$C6DA..$C8BA : result := 'Q';
$C8BB..$C8F5 : result := 'R';
$C8F6..$CBF9 : result := 'S';
$CBFA..$CDD9 : result := 'T';
$CDDA..$CEF3 : result := 'W';
$CEF4..$D188 : result := 'X';
$D1B9..$D4D0 : result := 'Y';
$D4D1..$D7F9 : result := 'Z';
else
result := char(32);
end;
end;
procedure TMainForm.btnConvertClick(Sender: TObject);
var
I: Integer;
PY: string;
s: string;
begin
s := '' ;
for I := 1 to Length(ChineseEdt.Text) div 2 do
begin
PY := Copy(ChineseEdt.Text, I * 2 - 1, 2);
s := s + GetPYIndexChar(PY);
end;
PYEdt.Text := s;
end;
end.
#2
最近太忙了,那位好心给翻译一下吧:-0
#3
以前在PB上也有人贴过
多音字是个大问题
我先看看这段代码……
@_@
多音字是个大问题
我先看看这段代码……
@_@
#4
多谢这位给df代码的大哥,但是小弟df不懂的呀。能不能给bcb的呀!!!
很急呢!!!
很急呢!!!
#5
这实际上就是根据汉字区位码里的二级字库做拼音转换的吧,因为二级国标字库是按拼音排序的,不过多音字确实是个头疼的问题。
#6
char GetPYIndexChar(char *str) //(Word str)
{Word x = (int(str[0]))<<8+str[1];
//Word x = *((Word *)str); //在X86上可行
Word Address[] =
{0xB0A1,0xB0C5,0xB2C1,0xB4EE,0xB6EA,
0xB7A2,0xB8C1,0xB9FE,0xBBF7,0xBFA6,
0xC0AC,0xC2E8,0xC4C3,0xC5B6,0xC5BE,
0xC6DA,0xC8BB,0xC8F6,0xCBFA,0xCDDA,
0xCEF4,0xD1B9,0xD4D1
};
char Rchar[25] = " ABCDEFGHJKLMNOPQESTWXYZ ";
int i=0;
for(;i<24;i++)
if(Address[i] < x ) break;
return Rchar[i];
}
{Word x = (int(str[0]))<<8+str[1];
//Word x = *((Word *)str); //在X86上可行
Word Address[] =
{0xB0A1,0xB0C5,0xB2C1,0xB4EE,0xB6EA,
0xB7A2,0xB8C1,0xB9FE,0xBBF7,0xBFA6,
0xC0AC,0xC2E8,0xC4C3,0xC5B6,0xC5BE,
0xC6DA,0xC8BB,0xC8F6,0xCBFA,0xCDDA,
0xCEF4,0xD1B9,0xD4D1
};
char Rchar[25] = " ABCDEFGHJKLMNOPQESTWXYZ ";
int i=0;
for(;i<24;i++)
if(Address[i] < x ) break;
return Rchar[i];
}
#7
void __fastcall TForm1::Button1Click(TObject *Sender)
{ unsigned int ChineseChar = 0;
unsigned char cChar[3] = " ";
// 假设你在Edit1里面只输入一个汉字,而且是一个正确的汉字。
memcpy(cChar, Edit1->Text.c_str(), 2);
ChineseChar = (cChar[0] << 8) + cChar[1];
if ((ChineseChar >= 0xB0A1) && (ChineseChar <= 0xB0C4)) ShowMessage("A");
if ((ChineseChar >= 0xB0C5) && (ChineseChar <= 0xB2C0)) ShowMessage("B");
if ((ChineseChar >= 0xB2C1) && (ChineseChar <= 0xB4ED)) ShowMessage("C");
// 下面的不用我再写了吧.
}
{ unsigned int ChineseChar = 0;
unsigned char cChar[3] = " ";
// 假设你在Edit1里面只输入一个汉字,而且是一个正确的汉字。
memcpy(cChar, Edit1->Text.c_str(), 2);
ChineseChar = (cChar[0] << 8) + cChar[1];
if ((ChineseChar >= 0xB0A1) && (ChineseChar <= 0xB0C4)) ShowMessage("A");
if ((ChineseChar >= 0xB0C5) && (ChineseChar <= 0xB2C0)) ShowMessage("B");
if ((ChineseChar >= 0xB2C1) && (ChineseChar <= 0xB4ED)) ShowMessage("C");
// 下面的不用我再写了吧.
}
#8
有人翻译了啊!真热心啊!好样的。
#9
但是好象还是不能实现的呢?
我的问题是:1,就是能不能实现一个汉字直接与由汉字组成的字符串相比较,如果在此字符串中能找到这个汉字的话,就返回一个首字母。
2,怎么样把一个汉字转换成16进制的数,然后在与汉字库里的范围作比较。
我的问题是:1,就是能不能实现一个汉字直接与由汉字组成的字符串相比较,如果在此字符串中能找到这个汉字的话,就返回一个首字母。
2,怎么样把一个汉字转换成16进制的数,然后在与汉字库里的范围作比较。
#10
1:子字符串的查找你可以利用AnsiString的AnsiPos函数完成,然后再做汉字拼音的查询。
2:把汉字转换成16进制的数我在上面的例子里不是写得很清楚嘛,仔细看看ChineseChar = (cChar[0] << 8) + cChar[1];
2:把汉字转换成16进制的数我在上面的例子里不是写得很清楚嘛,仔细看看ChineseChar = (cChar[0] << 8) + cChar[1];
#11
好象像caoguangxin大哥说的这样将汉字转换成16进制是不行的呀。
大家能不能再帮我看看,最好你先试一下,能实现了。然后在教给小弟,如何?谢谢了!!!
大家能不能再帮我看看,最好你先试一下,能实现了。然后在教给小弟,如何?谢谢了!!!
#12
为什么要转换到16进制呢?
如果有一个汉字:
char* hz="好";
int a1,a2;
a1=hz[0];
a2=hz[1];
就已经可以得到该汉字的内码了。
如果有一个汉字:
char* hz="好";
int a1,a2;
a1=hz[0];
a2=hz[1];
就已经可以得到该汉字的内码了。
#13
这样可以取到汉字的内码吗?
那如果就像这样的话,如果要将“好”字转换成0xBAC3呢?
该如何实现呢!
就是象两个16进制的数相加
那如果就像这样的话,如果要将“好”字转换成0xBAC3呢?
该如何实现呢!
就是象两个16进制的数相加
#14
给你一个能用的函数
得到声母:
AnsiString ConvertHZToPY(char *as_HzString)
{
static int li_SecPosValue[]={1601,1637,1833,2078,2274,2302,2433,2594,2787,3106,3212,3472,3635,3722,3730,3858,4027,4086,4390,4558,4684,4925,5249};
static char* lc_FirstLetter[] = {"A", "B","C","D","E","F","G","H","J","K","L","M","N","O","P","Q","R","S","T","W","X","Y","Z"};
static char* ls_SecondSecT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int j;
for( i = 0; i < stringlen; i ++ )
{
H = (unsigned char)(as_HzString[i + 0]);
L = (unsigned char)(as_HzString[i + 1]);
if(H < 0xA1 || L < 0xA1)
{
result += as_HzString[i];
continue;
}
else W = (H - 160) * 100 + L - 160;
if(W > 1600 && W < 5590)
{
for(j = 22; j >= 0; j --)
if(W >= li_SecPosValue[j])
{
result += lc_FirstLetter[j];
i ++;
break;
}
continue;
}
else
{
i ++;
W = ( H - 160 - 56 )*94 + L - 161;
if(W >= 0 && W <= 3007)
result += ls_SecondSecTable[W];
else
{
result += (char)H;
result += (char)L;
}
}
}
return result;
}
得到声母:
AnsiString ConvertHZToPY(char *as_HzString)
{
static int li_SecPosValue[]={1601,1637,1833,2078,2274,2302,2433,2594,2787,3106,3212,3472,3635,3722,3730,3858,4027,4086,4390,4558,4684,4925,5249};
static char* lc_FirstLetter[] = {"A", "B","C","D","E","F","G","H","J","K","L","M","N","O","P","Q","R","S","T","W","X","Y","Z"};
static char* ls_SecondSecTable =
"CJWGNSPGCGNE[Y[BTYYZDXYKYGT[JNNJQMBSGZSCYJSYY[PGKBZGY[YWJKGKLJYWKPJQHY[W[DZLSGMRYPYWWCCKZNKYYGTTNJJNYKKZYTCJNMCYLQLYPYQFQRPZSLWBTGKJFYXJWZLTBNCXJJJJTXDTTSQZYCDXXHGCK[PHFFSS[YBGXLPPBYLL[HLXS[ZM[JHSOJNGHDZQYKLGJHSGQZHXQGKEZZWYSCSCJXYEYXADZPMDSSMZJZQJYZC[J[WQJBYZPXGZNZCPWHKXHQKMWFBPBYDTJZZKQHY"
"LYGXFPTYJYYZPSZLFCHMQSHGMXXSXJ[[DCSBBQBEFSJYHXWGZKPYLQBGLDLCCTNMAYDDKSSNGYCSGXLYZAYBNPTSDKDYLHGYMYLCXPY[JNDQJWXQXFYYFJLEJPZRXCCQWQQSBNKYMGPLBMJRQCFLNYMYQMSQYRBCJTHZTQFRXQHXMJJCJLXQGJMSHZKBSWYEMYLTXFSYDSWLYCJQXSJNQB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CPTXXZZSMPHPSHMCLMLDQFYQXSZYYDYJZZHQPDSZGLSTJBCKBXYQZJSGPSXQZQZRQTBDKYXZK"
"HHGFLBCSMDLDGDZDBLZYYCXNNCSYBZBFGLZZXSWMSCCMQNJQSBDQSJTXXMBLTXZCLZSHZCXRQJGJYLXZFJPHYMZQQYDFQJJLZZNZJCDGZYGCTXMZYSCTLKPHTXHTLBJXJLXSCDQXCBBTJFQZFSLTJBTKQBXXJJLJCHCZDBZJDCZJDCPRNPQCJPFCZLCLZXZDMXMPHJSGZGSZZQLYLWTJPFSYASMCJBTZKYCWMYTCSJJLJCQLWZMALBXYFBPNLSFHTGJWEJJXXGLLJSTGSHJQLZFKCGNNNSZFDEQ"
"FHBSAQTGYLBXMMYGSZLDYDQMJJRGBJTKGDHGKBLQKBDMBYLXWCXYTTYBKMRTJZXQJBHLMHMJJZMQASLDCYXYQDLQCAFYWYXQHZ";
AnsiString result = "";
int H,L,W;
unsigned int i, stringlen = strlen(as_HzString);
int j;
for( i = 0; i < stringlen; i ++ )
{
H = (unsigned char)(as_HzString[i + 0]);
L = (unsigned char)(as_HzString[i + 1]);
if(H < 0xA1 || L < 0xA1)
{
result += as_HzString[i];
continue;
}
else W = (H - 160) * 100 + L - 160;
if(W > 1600 && W < 5590)
{
for(j = 22; j >= 0; j --)
if(W >= li_SecPosValue[j])
{
result += lc_FirstLetter[j];
i ++;
break;
}
continue;
}
else
{
i ++;
W = ( H - 160 - 56 )*94 + L - 161;
if(W >= 0 && W <= 3007)
result += ls_SecondSecTable[W];
else
{
result += (char)H;
result += (char)L;
}
}
}
return result;
}
#15
发给你了,看看吧
#16
那个我自己已经搞定了,谢谢大家的关照!!!
#1
把下面的代码翻译成BCB吧。
// 获取指定汉字的拼音索引字母,如:“汉”的索引字母是“H”
//用来获取汉字的拼音的一个小程序(含源码),但是不能区别多音字
function GetPYIndexChar( hzchar:string):char;
begin
case WORD(hzchar[1]) shl 8 + WORD(hzchar[2]) of
$B0A1..$B0C4 : result := 'A';
$B0C5..$B2C0 : result := 'B';
$B2C1..$B4ED : result := 'C';
$B4EE..$B6E9 : result := 'D';
$B6EA..$B7A1 : result := 'E';
$B7A2..$B8C0 : result := 'F';
$B8C1..$B9FD : result := 'G';
$B9FE..$BBF6 : result := 'H';
$BBF7..$BFA5 : result := 'J';
$BFA6..$C0AB : result := 'K';
$C0AC..$C2E7 : result := 'L';
$C2E8..$C4C2 : result := 'M';
$C4C3..$C5B5 : result := 'N';
$C5B6..$C5BD : result := 'O';
$C5BE..$C6D9 : result := 'P';
$C6DA..$C8BA : result := 'Q';
$C8BB..$C8F5 : result := 'R';
$C8F6..$CBF9 : result := 'S';
$CBFA..$CDD9 : result := 'T';
$CDDA..$CEF3 : result := 'W';
$CEF4..$D188 : result := 'X';
$D1B9..$D4D0 : result := 'Y';
$D4D1..$D7F9 : result := 'Z';
else
result := char(32);
end;
end;
procedure TMainForm.btnConvertClick(Sender: TObject);
var
I: Integer;
PY: string;
s: string;
begin
s := '' ;
for I := 1 to Length(ChineseEdt.Text) div 2 do
begin
PY := Copy(ChineseEdt.Text, I * 2 - 1, 2);
s := s + GetPYIndexChar(PY);
end;
PYEdt.Text := s;
end;
end.
// 获取指定汉字的拼音索引字母,如:“汉”的索引字母是“H”
//用来获取汉字的拼音的一个小程序(含源码),但是不能区别多音字
function GetPYIndexChar( hzchar:string):char;
begin
case WORD(hzchar[1]) shl 8 + WORD(hzchar[2]) of
$B0A1..$B0C4 : result := 'A';
$B0C5..$B2C0 : result := 'B';
$B2C1..$B4ED : result := 'C';
$B4EE..$B6E9 : result := 'D';
$B6EA..$B7A1 : result := 'E';
$B7A2..$B8C0 : result := 'F';
$B8C1..$B9FD : result := 'G';
$B9FE..$BBF6 : result := 'H';
$BBF7..$BFA5 : result := 'J';
$BFA6..$C0AB : result := 'K';
$C0AC..$C2E7 : result := 'L';
$C2E8..$C4C2 : result := 'M';
$C4C3..$C5B5 : result := 'N';
$C5B6..$C5BD : result := 'O';
$C5BE..$C6D9 : result := 'P';
$C6DA..$C8BA : result := 'Q';
$C8BB..$C8F5 : result := 'R';
$C8F6..$CBF9 : result := 'S';
$CBFA..$CDD9 : result := 'T';
$CDDA..$CEF3 : result := 'W';
$CEF4..$D188 : result := 'X';
$D1B9..$D4D0 : result := 'Y';
$D4D1..$D7F9 : result := 'Z';
else
result := char(32);
end;
end;
procedure TMainForm.btnConvertClick(Sender: TObject);
var
I: Integer;
PY: string;
s: string;
begin
s := '' ;
for I := 1 to Length(ChineseEdt.Text) div 2 do
begin
PY := Copy(ChineseEdt.Text, I * 2 - 1, 2);
s := s + GetPYIndexChar(PY);
end;
PYEdt.Text := s;
end;
end.
#2
最近太忙了,那位好心给翻译一下吧:-0
#3
以前在PB上也有人贴过
多音字是个大问题
我先看看这段代码……
@_@
多音字是个大问题
我先看看这段代码……
@_@
#4
多谢这位给df代码的大哥,但是小弟df不懂的呀。能不能给bcb的呀!!!
很急呢!!!
很急呢!!!
#5
这实际上就是根据汉字区位码里的二级字库做拼音转换的吧,因为二级国标字库是按拼音排序的,不过多音字确实是个头疼的问题。
#6
char GetPYIndexChar(char *str) //(Word str)
{Word x = (int(str[0]))<<8+str[1];
//Word x = *((Word *)str); //在X86上可行
Word Address[] =
{0xB0A1,0xB0C5,0xB2C1,0xB4EE,0xB6EA,
0xB7A2,0xB8C1,0xB9FE,0xBBF7,0xBFA6,
0xC0AC,0xC2E8,0xC4C3,0xC5B6,0xC5BE,
0xC6DA,0xC8BB,0xC8F6,0xCBFA,0xCDDA,
0xCEF4,0xD1B9,0xD4D1
};
char Rchar[25] = " ABCDEFGHJKLMNOPQESTWXYZ ";
int i=0;
for(;i<24;i++)
if(Address[i] < x ) break;
return Rchar[i];
}
{Word x = (int(str[0]))<<8+str[1];
//Word x = *((Word *)str); //在X86上可行
Word Address[] =
{0xB0A1,0xB0C5,0xB2C1,0xB4EE,0xB6EA,
0xB7A2,0xB8C1,0xB9FE,0xBBF7,0xBFA6,
0xC0AC,0xC2E8,0xC4C3,0xC5B6,0xC5BE,
0xC6DA,0xC8BB,0xC8F6,0xCBFA,0xCDDA,
0xCEF4,0xD1B9,0xD4D1
};
char Rchar[25] = " ABCDEFGHJKLMNOPQESTWXYZ ";
int i=0;
for(;i<24;i++)
if(Address[i] < x ) break;
return Rchar[i];
}
#7
void __fastcall TForm1::Button1Click(TObject *Sender)
{ unsigned int ChineseChar = 0;
unsigned char cChar[3] = " ";
// 假设你在Edit1里面只输入一个汉字,而且是一个正确的汉字。
memcpy(cChar, Edit1->Text.c_str(), 2);
ChineseChar = (cChar[0] << 8) + cChar[1];
if ((ChineseChar >= 0xB0A1) && (ChineseChar <= 0xB0C4)) ShowMessage("A");
if ((ChineseChar >= 0xB0C5) && (ChineseChar <= 0xB2C0)) ShowMessage("B");
if ((ChineseChar >= 0xB2C1) && (ChineseChar <= 0xB4ED)) ShowMessage("C");
// 下面的不用我再写了吧.
}
{ unsigned int ChineseChar = 0;
unsigned char cChar[3] = " ";
// 假设你在Edit1里面只输入一个汉字,而且是一个正确的汉字。
memcpy(cChar, Edit1->Text.c_str(), 2);
ChineseChar = (cChar[0] << 8) + cChar[1];
if ((ChineseChar >= 0xB0A1) && (ChineseChar <= 0xB0C4)) ShowMessage("A");
if ((ChineseChar >= 0xB0C5) && (ChineseChar <= 0xB2C0)) ShowMessage("B");
if ((ChineseChar >= 0xB2C1) && (ChineseChar <= 0xB4ED)) ShowMessage("C");
// 下面的不用我再写了吧.
}
#8
有人翻译了啊!真热心啊!好样的。
#9
但是好象还是不能实现的呢?
我的问题是:1,就是能不能实现一个汉字直接与由汉字组成的字符串相比较,如果在此字符串中能找到这个汉字的话,就返回一个首字母。
2,怎么样把一个汉字转换成16进制的数,然后在与汉字库里的范围作比较。
我的问题是:1,就是能不能实现一个汉字直接与由汉字组成的字符串相比较,如果在此字符串中能找到这个汉字的话,就返回一个首字母。
2,怎么样把一个汉字转换成16进制的数,然后在与汉字库里的范围作比较。
#10
1:子字符串的查找你可以利用AnsiString的AnsiPos函数完成,然后再做汉字拼音的查询。
2:把汉字转换成16进制的数我在上面的例子里不是写得很清楚嘛,仔细看看ChineseChar = (cChar[0] << 8) + cChar[1];
2:把汉字转换成16进制的数我在上面的例子里不是写得很清楚嘛,仔细看看ChineseChar = (cChar[0] << 8) + cChar[1];
#11
好象像caoguangxin大哥说的这样将汉字转换成16进制是不行的呀。
大家能不能再帮我看看,最好你先试一下,能实现了。然后在教给小弟,如何?谢谢了!!!
大家能不能再帮我看看,最好你先试一下,能实现了。然后在教给小弟,如何?谢谢了!!!
#12
为什么要转换到16进制呢?
如果有一个汉字:
char* hz="好";
int a1,a2;
a1=hz[0];
a2=hz[1];
就已经可以得到该汉字的内码了。
如果有一个汉字:
char* hz="好";
int a1,a2;
a1=hz[0];
a2=hz[1];
就已经可以得到该汉字的内码了。
#13
这样可以取到汉字的内码吗?
那如果就像这样的话,如果要将“好”字转换成0xBAC3呢?
该如何实现呢!
就是象两个16进制的数相加
那如果就像这样的话,如果要将“好”字转换成0xBAC3呢?
该如何实现呢!
就是象两个16进制的数相加
#14
给你一个能用的函数
得到声母:
AnsiString ConvertHZToPY(char *as_HzString)
{
static int li_SecPosValue[]={1601,1637,1833,2078,2274,2302,2433,2594,2787,3106,3212,3472,3635,3722,3730,3858,4027,4086,4390,4558,4684,4925,5249};
static char* lc_FirstLetter[] = {"A", "B","C","D","E","F","G","H","J","K","L","M","N","O","P","Q","R","S","T","W","X","Y","Z"};
static char* ls_SecondSecTable =
"CJWGNSPGCGNE[Y[BTYYZDXYKYGT[JNNJQMBSGZSCYJSYY[PGKBZGY[YWJKGKLJYWKPJQHY[W[DZLSGMRYPYWWCCKZNKYYGTTNJJNYKKZYTCJNMCYLQLYPYQFQRPZSLWBTGKJFYXJWZLTBNCXJJJJTXDTTSQZYCDXXHGCK[PHFFSS[YBGXLPPBYLL[HLXS[ZM[JHSOJNGHDZQYKLGJHSGQZHXQGKEZZWYSCSCJXYEYXADZPMDSSMZJZQJYZC[J[WQJBYZPXGZNZCPWHKXH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DJLSLYGKDZPZXJ"
"YYZLWCXSZFGWYYDLYHCLJSCMBJHBLYZLYCBLYDPDQYSXQZBYTDKYXJY[CNRJMPDJGKLCLJBCTBJDDBBLBLCZQRPPXJCJLZCSHLTOLJNMDDDLNGKAQHQHJGYKHEZNMSHRP[QQJCHGMFPRXHJGDYCHGHLYRZQLCYQJNZSQTKQJYMSZSWLCFQQQXYFGGYPTQWLMCRNFKKFSYYLQBMQAMMMYXCTPSHCPTXXZZSMPHPSHMCLMLDQFYQXSZYYDYJZZHQPDSZGLSTJBCKBXYQZJSGPSXQZQZRQTBDKYXZK"
"HHGFLBCSMDLDGDZDBLZYYCXNNCSYBZBFGLZZXSWMSCCMQNJQSBDQSJTXXMBLTXZCLZSHZCXRQJGJYLXZFJPHYMZQQYDFQJJLZZNZJCDGZYGCTXMZYSCTLKPHTXHTLBJXJLXSCDQXCBBTJFQZFSLTJBTKQBXXJJLJCHCZDBZJDCZJDCPRNPQCJPFCZLCLZXZDMXMPHJSGZGSZZQLYLWTJPFSYASMCJBTZKYCWMYTCSJJLJCQLWZMALBXYFBPNLSFHTGJWEJJXXGLLJSTGSHJQLZFKCGNNNSZFDEQ"
"FHBSAQTGYLBXMMYGSZLDYDQMJJRGBJTKGDHGKBLQKBDMBYLXWCXYTTYBKMRTJZXQJBHLMHMJJZMQASLDCYXYQDLQCAFYWYXQHZ";
AnsiString result = "";
int H,L,W;
unsigned int i, stringlen = strlen(as_HzString);
int j;
for( i = 0; i < stringlen; i ++ )
{
H = (unsigned char)(as_HzString[i + 0]);
L = (unsigned char)(as_HzString[i + 1]);
if(H < 0xA1 || L < 0xA1)
{
result += as_HzString[i];
continue;
}
else W = (H - 160) * 100 + L - 160;
if(W > 1600 && W < 5590)
{
for(j = 22; j >= 0; j --)
if(W >= li_SecPosValue[j])
{
result += lc_FirstLetter[j];
i ++;
break;
}
continue;
}
else
{
i ++;
W = ( H - 160 - 56 )*94 + L - 161;
if(W >= 0 && W <= 3007)
result += ls_SecondSecTable[W];
else
{
result += (char)H;
result += (char)L;
}
}
}
return result;
}
得到声母:
AnsiString ConvertHZToPY(char *as_HzString)
{
static int li_SecPosValue[]={1601,1637,1833,2078,2274,2302,2433,2594,2787,3106,3212,3472,3635,3722,3730,3858,4027,4086,4390,4558,4684,4925,5249};
static char* lc_FirstLetter[] = {"A", "B","C","D","E","F","G","H","J","K","L","M","N","O","P","Q","R","S","T","W","X","Y","Z"};
static char* ls_SecondSecTable =
"CJWGNSPGCGNE[Y[BTYYZDXYKYGT[JNNJQMBSGZSCYJSYY[PGKBZGY[YWJKGKLJYWKPJQHY[W[DZLSGMRYPYWWCCKZNKYYGTTNJJNYKKZYTCJNMCYLQLYPYQFQRPZSLWBTGKJFYXJWZLTBNCXJJJJTXDTTSQZYCDXXHGCK[PHFFSS[YBGXLPPBYLL[HLXS[ZM[JHSOJNGHDZQYKLGJHSGQZHXQGKEZZWYSCSCJXYEYXADZPMDSSMZJZQJYZC[J[WQJBYZPXGZNZCPWHKXHQKMWFBPBYDTJZZKQHY"
"LYGXFPTYJYYZPSZLFCHMQSHGMXXSXJ[[DCSBBQBEFSJYHXWGZKPYLQBGLDLCCTNMAYDDKSSNGYCSGXLYZAYBNPTSDKDYLHGYMYLCXPY[JNDQJWXQXFYYFJLEJPZRXCCQWQQSBNKYMGPLBMJRQCFLNYMYQMSQYRBCJTHZTQFRXQHXMJJCJLXQGJMSHZKBSWYEMYLTXFSYDSWLYCJQXSJNQBSCTYHBFTDCYZDJWYGHQFRXWCKQKXEBPTLPXJZSRMEBWHJLBJSLYYSMDXLCLQKXLHXJRZJMFQHXHWY"
"WSBHTRXXGLHQHFNM[YKLDYXZPYLGG[MTCFPAJJZYLJTYANJGBJPLQGDZYQYAXBKYSECJSZNSLYZHSXLZCGHPXZHZNYTDSBCJKDLZAYFMYDLEBBGQYZKXGLDNDNYSKJSHDLYXBCGHXYPKDJMMZNGMMCLGWZSZXZJFZNMLZZTHCSYDBDLLSCDDNLKJYKJSYCJLKWHQASDKN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SZZQLYLWTJPFSYASMCJBTZKYCWMYTCSJJLJCQLWZMALBXYFBPNLSFHTGJWEJJXXGLLJSTGSHJQLZFKCGNNNSZFDEQ"
"FHBSAQTGYLBXMMYGSZLDYDQMJJRGBJTKGDHGKBLQKBDMBYLXWCXYTTYBKMRTJZXQJBHLMHMJJZMQASLDCYXYQDLQCAFYWYXQHZ";
AnsiString result = "";
int H,L,W;
unsigned int i, stringlen = strlen(as_HzString);
int j;
for( i = 0; i < stringlen; i ++ )
{
H = (unsigned char)(as_HzString[i + 0]);
L = (unsigned char)(as_HzString[i + 1]);
if(H < 0xA1 || L < 0xA1)
{
result += as_HzString[i];
continue;
}
else W = (H - 160) * 100 + L - 160;
if(W > 1600 && W < 5590)
{
for(j = 22; j >= 0; j --)
if(W >= li_SecPosValue[j])
{
result += lc_FirstLetter[j];
i ++;
break;
}
continue;
}
else
{
i ++;
W = ( H - 160 - 56 )*94 + L - 161;
if(W >= 0 && W <= 3007)
result += ls_SecondSecTable[W];
else
{
result += (char)H;
result += (char)L;
}
}
}
return result;
}
#15
发给你了,看看吧
#16
那个我自己已经搞定了,谢谢大家的关照!!!