You can use IndexStr
from StrUtils
, returns -1
if string not found e.g.
Caption := IntToStr(
IndexStr(FormatSettings.LongMonthNames[7], FormatSettings.LongMonthNames) + 1);
EDIT:
To avoid problems with casting and case sensitivity you might use IndexText
as shown:
Function GetMonthNumber(Const Month:String):Integer; overload;
begin
Result := IndexText(Month,FormatSettings.LongMonthNames)+1
end;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…