【求助】请问 IsDirectory := Line[1] = 'd';是什么意思?其中...

suihu 2005-05-08 03:16:10
有这个一段小函数:

function GetNameFromDirLine(Line: String; Var IsDirectory: Boolean): String;
Var
i: Integer;
DosListing: Boolean;
begin
------------------------------------------------------------------
IsDirectory := Line[1] = 'd';

//这句话是什么意思?
//Line是String型
------------------------------------------------------------------
DosListing := false;
for i := 0 to 7 do begin
if (i = 2) and not IsDirectory then begin
IsDirectory := Copy(Line, 1, Pos(' ', Line) - 1) = '<DIR>';
if not IsDirectory then
DosListing := Line[1] in ['0'..'9']
else DosListing := true;
end;
Delete(Line, 1, Pos(' ', Line));
While Line[1] = ' ' do Delete(Line, 1, 1);
if DosListing and (i = 2) then break;
end;
Result := Line;
end;
------------------------------------
...全文
87 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
gzmhero 2005-05-08
  • 打赏
  • 举报
回复
IsDirectory := Line[1] = 'd';

相当于:
取Line字符串的第一个字符

if Line[1]='d' then
IsDirectory:=true
else
IsDirectory:=false;

828

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧