SAY討論區

標題: [已解](Delphi) - StringToCaseSelect 哪里出錯?? [打印本頁]

作者: frankyhui    時間: 2012-5-12 02:40:13     標題: [已解](Delphi) - StringToCaseSelect 哪里出錯??

procedure TForm1.FormCreate(Sender: TObject);

function StringToCaseSelect
(Selector : String;
CaseList : Array of String) : Integer;

var cnt : Integer;

begin
Result := -1;
for cnt := 0 to Length(CaseList) -1 do

begin
if CompareText(Selector, CaseList[cnt]) = 0 then

begin
Result := cnt;
Break;

end;
end;
end;

{
Usage:
case StringToCaseSelect('Delphi',
['About','Borland','Delphi']) of
0:ShowMessage('Youve picked About');
1:ShowMessage('Youve picked Borland');
2:ShowMessage('Youve picked Delphi');
end;
}

end.

问题显示:BEGIN expected but END found 和 Declaration expected but end of file found
==========================================================

[ 本帖最後由 1910X3 於 2010-05-08 09:30 AM 編輯 ]




歡迎光臨 SAY討論區 (http://forum.go2tutor.com/) Powered by Discuz! X2