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

Delphi
闪动标题栏
制作真正的TopMost窗口
制作类似WinAmp一样的“磁性”窗口
不可移动的窗口示例代码
自制替换指定串函数
Delphi中RichEdit的奥妙
Delphi数据集过滤技巧
为VB应用程序定制浮动提示
DELPHI图形编辑技巧二则
Delphi使用技巧两则
Delphi 3.0中的函数调用模式
Delphi3中制作快速按钮条
Delphi 4增订的Object Pascal
Delphi3.0中的函数调用模式
DCU文件(编译的库单元)的重用
命令行参数的使用
在编译时获得提示
运行时生成控件
任意打印
分行提示

教你如何用Delphi生成GBK码表


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