一維數組的運用

{...............................................................................
//  使用方式﹕判斷輸入的路徑是否合法
//  函式名稱﹕Gvt_GetCheckPath
//  傳入參數﹕Str: 路徑
//  返回值﹕  Boolean
...............................................................................}
function Gvt_GetCheckPath(Str: string): Boolean;
const
Cv_Letters: array[0..25] of char=('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
Cv_Letters2: array[0..25] of char=('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
Cv_Letters3: array[0..15] of char=('.','=','+','-','*','/','~','!','@','#','\$','%','&','^','<','>');
var
Lv_i, Lv_j, Lv_Time: Integer;
begin
Result := True;
Lv_i := 3;
Lv_Time := 0;

for Lv_j := 0 to 25 do
begin
if (Copy(Str,1,1)<>Cv_Letters[Lv_j])
and (Copy(Str,1,1)<>Cv_Letters2[Lv_j])
then
Inc(Lv_Time);
end;
if (Lv_Time=26) or (Copy(Str,2,1)<>':')then
begin
Result := False;
Exit;
end;

while Lv_i<Length(Str) do
begin
if ((Copy(Str,Lv_i,1)='/') and (Copy(Str,Lv_i+1,1)='/')) then
begin
Result := False;
Exit;
end;
for Lv_j := 0 to 15 do
begin
if Copy(Str,Lv_i,1)=Cv_Letters3[Lv_j] then
begin
Result := False;
Exit;
end;
end;
Inc(Lv_i);
end;
end;

• 本文已收录于以下专栏：

举报原因： 您举报文章：一維數組的運用 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)