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

Delphi
Delphi 4.0 制作数据库发行盘技巧
用Delphi 开发数据库程序经验三则
在Delphi中定位文件位置
Delphi编程技巧实例
delphi构件制作方法简介
在Delphi中如何控制其它应用程序窗口
用Delphi实现远程屏幕抓取
用Delphi6制作网页特效软件
Delphi多层应用程序的实现
Delphi下汉字输入法的编程及使用
Delphi巧克力的滋味(1)
DELPHI下汉字输入法的编程及使用(1)
Delphi中高级DLL的编写和调用(1)
Delphi中实现多线程同步查询(1)
Delphi中实现多线程同步查询(2)
Delphi中对Oracle存取RTF文档(1)
Delphi5实现多层Client/Server应用程序(1)
扩展Delphi的线程同步对象(1)
Delphi制作带图标的弹出式选单
用Delphi编写安装程序(1)

教你如何用Delphi生成GBK码表


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-30   浏览: 93 ::
收藏到网摘: 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.