The first time I wrote Delphi todayCodeAlways prompts "constant expression expected ". It took two hours to solve this problem. It would have been less of a begin... end;
It's so disgusting. The error prompt and the real cause are not at all, so you can't cry.
Error code:
Case Param [1] [1]
'D ':
Parts [I]: = datetostr (date );
'I ':
Parts [I]: = '';
Iindexstart: = strtoint (Param [2]); // the error message returned when an error occurs.
Iindexposition: = I;
Iindexlength: = strtoint (Param [3]);
'R ':
Parts [I]: = '';
Irndposition: = I;
Irndlength: = strtoint (Param [2]);
End;
Code after modification:
Case Param [1] [1]
'D ':
Parts [I]: = datetostr (date );
'I ':
Begin
Parts [I]: = '';
Iindexstart: = strtoint (Param [2]);
Iindexposition: = I;
Iindexlength: = strtoint (Param [3]);
End;
'R ':
Begin
Parts [I]: = '';
Irndposition: = I;
Irndlength: = strtoint (Param [2]);
End;
End;