⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 big2gb.pas

📁 提供中文简体到繁体的转换
💻 PAS
字号:
unit BIG2GB;

interface

uses
  Windows, Classes, Messages, SysUtils;
const
  
  BIGfirst = $A140; // first code of BIG
  BIGlast  = $F9FE; // last code of BIG 
  BIGsize  = $58BF; // BIGlast - BIGfirst + 1 
  
  
type
  TBIG2GB = class(TComponent)
  private
    { Private declarations }
    Instance : THandle;
    BIGTAB : TResourceStream;
  protected
    { Protected declarations }
  public
    { Public declarations }
    function BIG5toGB(S: string): string;
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
  published
    { Published declarations }
  end;
  
procedure register;

  
implementation
{$R BIG2GB32.res}
constructor TBIG2GB.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  if Not(csDesigning in ComponentState) then
  begin
  BIGTAB := TResourceStream.Create(Instance, 'BIG2GB', RT_RCDATA);
  
  end;
end;

destructor TBIG2GB.Destroy;
begin
  BIGTAB.free;
  inherited Destroy;
end;


function TBIG2GB.BIG5toGB(S: string): string;
var
  bak   : string; 
  C  : array[0..1] of Byte;
  I  : Integer;            
  W  : PWordArray;         
  CA : array[0..2] of Char;
begin
  bak := '';
  I := 1;
  w:=@(C[0]);
  while I <= Length(S) do
  begin
    C[1] := Byte(S[I]);
    if C[1] > $A0 then
    begin
      inc(I, 1);
      C[0] := byte(S[I]);
      inc(I, 1);
      W[0] := W[0] - BIGfirst;
      BigTAB.Position:= W[0]*2;
      BIGTAB.Read(CA,2);
      CA[2]:=#0;
      bak := bak + StrPas(CA);
    end
    else
    begin
      bak := bak + S[I];
      inc(I, 1);
    end;
  end;
  Result := bak;
end;

procedure register;
begin
  RegisterComponents('Big5',[TBIG2GB]);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -