当前位置: 首页 > 图文教程 > 开发语言 > Delphi > 教你如何用Delphi生成GBK码表

Delphi
Delphi实现窗体控件自由摆布
利用Delphi编制IP地址转换器
用Indy组件开发Socket应用程序
Delphi模拟最小化恢复关闭按纽
简析XML及其在Delphi中的应用
Delphi开发基于DCOM的聊天室
Delphi实现远程串口的数据采集
Delphi托盘编程实战演练
在Delphi中使用电子邮件
Delphi开发98屏幕保护预览程序
Delphi实现同类型文档自动合并
Delphi 8 For .NET 抢先预览
Delphi图像存取另类解决方案
用Delphi实现动态获取版本信息
用Delphi客户端访问EJB组件
Delphi中数据网格DBGrid应用
Delphi数据库控件使用入门
Delphi下的COM编程技术简介
用Delphi轻松实现背景播放
也谈TTreeView、TListView用法

教你如何用Delphi生成GBK码表


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-30   浏览: 81 ::
收藏到网摘: n/a

 
用Delphi来做一个GBK的码表,代码其实也不长,大家主要掌握了一定的技巧,就能举一反三,生成更多的其它实例了。



  program GenGBKCode;
  {$APPTYPE CONSOLE}
  uses
  SysUtils;
  Var
  i, j: byte;
  mFile: textfile;
  begin
  AssignFile(mFile, 'GBKCode.txt');
  Rewrite(mFile);
  {
  GBK字符集范围
  分区                      高位     低位
  ----------------------------------------------
  ●GBK/1:GB2312非汉字符号: A1~A9 || A1~FE
  ●GBK/2:GB2312汉字      : B0~F7 || A1~FE
  ●GBK/3:扩充汉字        : 81~A0 || 40~FE
  ●GBK/4:扩充汉字        : AA~FE || 40~A0
  ●GBK/5:扩充非汉字      : A8~A9 || 40~A0
  }
  for i := $A1 to $A9 do
  for j := $A1 to $FE do
  Write(mFile, chr(i), chr(j));
  for i := $B0 to $F7 do
  for j := $A1 to $FE do
  Write(mFile, chr(i), chr(j));
  for i := $81 to $A0 do
  for j := $40 to $FE do
  Write(mFile, chr(i), chr(j));
  for i := $AA to $FE do
  for j := $40 to $A0 do
  Write(mFile, chr(i), chr(j));
  for i := $A8 to $A9 do
  for j := $40 to $A0 do
  Write(mFile, chr(i), chr(j));
  Close(mFile);
  end.