copy:http://www.jackfeng.com/archives/276/
{-------------------------------------------------------------------------------
過程名:
作者:
日期:
參數:
返回值:
-------------------------------------------------------------------------------}
function MakeFileList(Path,FileExt:string):TStringList ;
var
sch:TSearchrec;
begin
Result:=TStringlist.Create;
if rightStr(trim(Path), 1) <> '\'
then
else
if not DirectoryExists(Path) then
begin
end;
if FindFirst(Path + '*', faAnyfile, sch) = 0 then
begin
end;
end;
------------------------------------------------------------------------------------------------------------------------------------
字符截取函數LeftStr, MidStr, RightStr
這幾個函數都包含在StrUtils中,所以需要uses StrUtils;
假設字符串是 Dstr := ’Delphi is the BEST’, 那么
LeftStr(Dstr, 5) := ’Delph’
MidStr(Dstr, 6, 7) := ’i is th’
RightStr(Dstr, 6) := ’e BEST’
~~~~~~~~~~~~~~~~~~~~~~~~~
function RightStr
(Const Str: String; Size: Word): String;
begin
if Size > Length(Str) then Size := Length(Str) ;
RightStr := Copy(Str, Length(Str)-Size+1, Size)
end;
function MidStr
(Const Str: String; From, Size: Word): String;
begin
MidStr := Copy(Str, From, Size)
end;
function LeftStr
(Const Str: String; Size: Word): String;
begin
LeftStr := Copy(Str, 1, Size)
end;
這幾個函數經常結合Pos, Length, Copy使用