取汉字的机内码、UniCode码

//机内码 -> 汉字
Function MacCode2Chinese(AiUniCode : Integer) : String;
Var
  ch, cl : Integer;
Begin
  ch := AiUniCode Div 256;
  cl := AiUniCode Mod 256;
  Result := Chr(ch) + Chr(cl);
end;
http://i.mop.com/caibao35/blog
//汉字 -> 机内码
Function Chinese2MacCode(AiChinese : String) : Integer;
Var
  ch, cl : Integer;
Begin
  ch := Ord(AiChinese[1]);
  cl := Ord(AiChinese[2]);
  Result := (ch shl 8) + cl;
end;
50b2679b565acb70b30a07fb539c09d7
//UniCode -> 汉字
Function UniCode2Chinese(AiUniCode : Integer) : String;
Var
  ch, cl : String[3];
  s : String;
Begin
  s := IntToHex(AiUniCode, 2);
  cl := '$' + Copy(s, 1, 2);
  ch := '$' + Copy(s, 3, 2);
  s := Chr(StrToInt(ch)) + Chr(StrToInt(cl)) + #0;
  Result := WideCharToString(pWideChar(s));
end;

//汉字 -> UniCode
Function Chinese2UniCode(AiChinese : String) : Integer;
Var
  ch, cl : String[2];
  a : array [1..2] of char;
Begin
  StringToWideChar(Copy(AiChinese, 1, 2), @(a[1]), 2);
  ch := IntToHex(Integer(a[2]), 2);
  cl := IntToHex(Integer(a[1]), 2);
  Result := StrToInt('$' + ch + cl);
end;  

  虹口区 黄浦区 金山区 卢湾区 松江区 宝山区 南市区 长宁区 闸北区 浦东新区 嘉定区 杨浦区 普陀区 青浦县 闵行区 徐汇区 崇明县 静安区 奉贤县
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值