이런 함수 대충 하나 만들어두시고...
function StrInArr(aStr: String; aArr: array of String): Boolean;
var
i: Integer;
begin
Result := false;
for i:= Low(aArr) to High(aArr) do
if aArr[i] = aStr then
begin
Result := true;
Exit;
end;
end;
이렇게 쓰시면 어떨까요...
if StrInArr(sShListView.SelectedFolder.PathName, ['xxx', 'yyy', 'zzz'] then Exit;
사미 님이 쓰신 글 :
: if (sShListView.SelectedFolder.PathName = 'xxx') or
: (sShListView.SelectedFolder.PathName = 'yyy') or
: (sShListView.SelectedFolder.PathName = 'zzz') then
: exit;
:
: 이런 if문을 간단하게 줄일 수 있는 방법이 궁금합니다 ㅠㅠ
:
: if sShListView.SelectedFolder.PathName in ['xxx', 'yyy', 'zzz'] then exit;
:
: 이런 방법은 string이 아니라 char만 되는 것 같은데 ㅠㅠ
:
: 비슷한 방법으로 줄일 수 있는 방법이 없을까요?;
|