尋找簡繁 轉換函式
解决方案 »
- 求这工具的原理。。隐藏快捷方式里面的内容。
- ****客户端纠错问题****
- 很简单问题,fastreport中关于直接打印表格的几点问题(无未解帖记录)UP有分
- 有人帮我吗?
- 大虾帮帮忙吧,这段简单的多线程的代码什么错误啊?
- 用nmftp控件实现文件下载的过程中,连接连接被abort掉,但是传输并没有中断,只是不能下载文件了,如何实现再次连接并下载文件啊,帮帮忙啊
- 请问如何判断当前执行文件所处的路径?
- MDI问题,很急,请进!
- installshield developer 和installshield professional有什么区别?
- 请问高手:如何用上下键切换一系列的输入框?
- 关于线程卡死的问题
- 10位的数据怎么能提取出8位呢???
unit uBIG2GB;interfaceuses
Windows, Classes, Messages, SysUtils;function BIG5toGB(S: string): string;implementation
{$R BIG2GB32.res}const
BIGfirst = $A140; // first code of BIG
BIGlast = $F9FE; // last code of BIG
BIGsize = $58BF; // BIGlast - BIGfirst + 1
var
Instance : THandle;
BIGTAB : TResourceStream;procedure TBIG2GB_Create;
begin
BIGTAB := TResourceStream.Create(Instance, 'BIG2GB', RT_RCDATA);
end;procedure TBIG2GB_Destroy;
begin
BIGTAB.free;
end;
function 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;Initialization
TBIG2GB_Create;Finalization
TBIG2GB_Destroy;end.
unit uGB2BIG;interfaceuses
Windows, Messages, SysUtils, Classes;function GBtoBIG5(S: string): string;
//function GetBIGS(S: string): string;implementation
{$R GB2BIG32.res}const
GBfirst = $A1A1; // first code of GB */
GBlast = $FEFE; //last code of GB */
GBsize = $5E5E; // GBlast - GBfirst + 1 */
var
Instance: THandle;
GBTAB, DupCode, DupData: TResourceStream;procedure TGB2BIG_Create;
begin
GBTAB := TResourceStream.Create(Instance, 'GB2BIG', RT_RCDATA);
DupCode := TResourceStream.Create(Instance, 'DUPCODE', RT_RCDATA);
DupData := TResourceStream.Create(Instance, 'DUPDATA', RT_RCDATA);
end;procedure TGB2BIG_Destroy;
begin
GBTAB.free;
DupCode.free;
DupData.free;
end;
{
function TGB2BIG_GetBIGS(S: string): string;
var
C : array[0..5] of Char;
W : PWordArray;
CA : array[0..2] of Char;
I : Integer;
bak: string;
begin
bak := '';
if Byte(S[1]) > $A0 then
begin
W := @(C[0]);
C[2] := S[1];
C[3] := S[2];
C[5] := S[1];
C[4] := S[2];
W[2] := W[2] - GBfirst;
GBTAB.Position := W[2] * 2;
GBTAB.read (CA, 2);
CA[2] := #0;
bak := bak + StrPas(CA);
I := 0;
while I < DupCode.Size do
begin
DupCode.Position := I;
DupCode.read (C, 2);
if W[0] = W[1] then
begin
DupData.Position := I;
DupData.read (CA, 2);
CA[2] := #0;
bak := bak + CA;
end;
inc(I, 2);
end;
end;
Result := bak;
end;
}function {TGB2BIG.}GBtoBIG5(S: string): string;
var
bak: string;
C : array[0..1] of Byte;
I : Integer;
W : PWordArray;
CA : array[0..2] of Char;
begin
bak := '';
W := @(C[0]);
I := 1;
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] - GBfirst;
GBTAB.Position := W[0] * 2;
GBTAB.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;Initialization
TGB2BIG_Create;Finalization
TGB2BIG_Destroy;end.
还有2个50k的res文件。。
网上流传的简单转换结果,稍微有点儿文化的人都能看出问题来,使用繁体字的人更是笑掉大牙
不知道word有没有提供接口,它的准确率还凑合