/****************************16 into Chinese characters ***********************************/
Ansistring Tform1::hex_to_chinese (ansistring Hex)
{
Chinese and English figures mixed together can also be converted
ansistring ret;
for (int i=1; i{
Ansistring TempStr = "0x" + hex.substring (i,2);
RET + = ansistring ((char) (Tempstr.toint ()));
}
return ret;
}
/****************************16 into Chinese characters ***********************************/
/**************************** Kanji to 16 binary ***********************************/
Ansistring Tform1::chinese_to_hex (char* p_bcd, int ilen)
{
Chinese and English figures mixed together can also be converted
ansistring ret = "";
Char Hchar, Lchar, Temp;
for (int i=0; i<ilen; i++)
{
Temp = *p_bcd++;
Hchar = (temp&0xf0) >>4;
Lchar = (temp&0x0f);
if ((Hchar >= 0x00) && (Hchar <= 0x09))
Hchar + = 0x30;
if ((Hchar >= 0x0A) && (Hchar <= 0x0F))
Hchar + = 0x37;
if ((Lchar >= 0x00) && (Lchar <= 0x09))
Lchar + = 0x30;
if ((Lchar >= 0x0A) && (Lchar <= 0x0F))
Lchar + = 0x37;
RET + = ansistring (Hchar);
RET + = ansistring (Lchar);
}
return ret;
}
/**************************** Kanji to 16 binary ***********************************/
void __fastcall Tform1::button4click (tobject *sender)
{
String Strchinese = "Long live Chinese Communist Chanba Party";
D6d0b9fab9b29bbab5b3cdf2cbea This paragraph is a Chinese character in-machine code
String strtemp = Chinese_to_hex (Strchinese.c_str (), strchinese.length ());
Chinese_to_hex () This function turns the in-machine code is not GB code
ShowMessage (strtemp);
strtemp = Hex_to_chinese (strtemp);
ShowMessage (strtemp);
};
16 binary and Chinese characters of the mutual transfer! Go