引用下面代码便可:
unit BIG2GB;interfaceuses
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;
end.
unit BIG2GB;interfaceuses
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;
end.
解决方案 »
- stringgrid 控件 rowcount 的问题!
- spcomm 发送含结束符(#$00)的数据
- 用Format('%4s',['a']在'a'前面补上4-1个空格,我想在a的后面补上4-1个空格应该怎么做
- 这是怎么回事啊?高手请进[悬赏100分]
- 爱一个人,究竟能爱多久?
- 用DBTEXT后的问题!
- 在MDI中,有两个非模式的子窗体,我想通过其中一个调用另一个,怎么调用?
- 指纹机,及Delphi 下可编程接口程序?
- Where can I get wbzx for windows 2000?.Can you give me?
- DELPHI 6出来了,兄弟们现在可以WINNT、LINUX 通吃了。。。。。:)
- 通信协议编程
- 中间层为什么连接不上?
什么地方有它?!