📄 publicunit.pas
字号:
unit PublicUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxCheckListBox, cxControls, cxContainer, cxEdit, cxTextEdit,
cxMaskEdit, cxButtonEdit;
Function GetList(SqlText:string):TStringList; //读取清单
Function Lefts(Str:string):String; //字符串左字符
Function Rights(Str:string):String; //字符串右字符
Function ListToStr(sList :TstringList; sJoin : String):String;
Function GetPY(const AHzStr: string): string;
implementation
uses
DataUnit ,MainUnit;
Function GetList(SqlText:string):TStringList;
var
TmpList : TStringList ;
begin
TmpList:=TStringList.Create();
TmpList.Clear;
if copy(Sqltext,1,1)='P'
then Dm.TmpDataSet.Connection := DM.Conn_PM
else Dm.TmpDataSet.Connection := DM.Conn_UF;
With Dm.TmpDataSet do begin
Close ;
CommandText := SqlText;
Open ;
While Not Dm.TmpDataSet.Eof do begin
TmpList.Add(Fields[0].asString) ;
Next ;
End;
Close ;
End;
Result := TmpList ;
end;
Function Lefts(Str:string):String;
var
TmpString : String ;
begin
if pos('-', Str) <> 0 then TmpString := Copy(Str,1,pos('-', Str) -2 )
else TmpString := Str ;
Result := trim(TmpString) ;
end;
Function Rights(Str:string):String; //字符串右字符
var
TmpString : String ;
begin
if pos('-', Str) <> 0 then
TmpString := Copy(Str ,pos('-',Str)+2,Length(Str)-pos('-',Str )-1)
else TmpString := Str ;
Result := trim(TmpString) ;
end;
function ListToStr(sList :TstringList; sJoin : String):String; //权限判定
Var
sTemp : String;
i : Integer ;
Begin
For i := 0 To sList.Count - 1 do
Begin
if i = 0 Then sTemp := sList.Strings[i]
Else sTemp := sTemp + sJoin + sList.Strings[i];
End;
Result:= sTemp ;
End;
function GetPY(const AHzStr: string): string;
const
ChinaCode: array[0..25, 0..1] of Integer = ((1601, 1636), (1637, 1832), (1833, 2077),
(2078, 2273), (2274, 2301), (2302, 2432), (2433, 2593), (2594, 2786), (9999, 0000),
(2787, 3105), (3106, 3211), (3212, 3471), (3472, 3634), (3635, 3722), (3723, 3729),
(3730, 3857), (3858, 4026), (4027, 4085), (4086, 4389), (4390, 4557), (9999, 0000),
(9999, 0000), (4558, 4683), (4684, 4924), (4925, 5248), (5249, 5589));
var
i, j, HzOrd: integer;
begin
i := 1;
while i <= Length(AHzStr) do
begin
if (AHzStr[i] >= #160) and (AHzStr[i + 1] >= #160) then
begin
HzOrd := (Ord(AHzStr[i]) - 160) * 100 + Ord(AHzStr[i + 1]) - 160;
for j := 0 to 25 do
begin
if (HzOrd >= ChinaCode[j][0]) and (HzOrd <= ChinaCode[j][1]) then
begin
Result := Result + char(byte('A') + j);
break;
end;
end;
Inc(i);
end else Result := Result + AHzStr[i];
Inc(i);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -