Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
Delphi 10.2 Tokyo Professional
|
Re: Const in Function auslesen
9. Apr 2010, 22:16
Hallo,
Delphi-Quellcode:
uses
StrUtils;
const
Orte: Array[0..16] of String = ('Berlin', 'Kiel', 'Hamburg', 'Sachsen',...);
function Blubb(Ort: String): Integer;
var index: Integer;
begin
index := AnsiIndexStr(Ort,Orte);
end;
Blubb('Koblenz'); // -1
Blubb('Hamburg'); // 2
Gruß
Neutral General
Michael "Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
|
|
Zitat
|