It should be:
Valid := True;
for Idx := 1 to Length(TFRecord) do
begin
Character := TFRecord[Idx];
if (Character < 'A') or (Character > 'Z') then Valid := False;
end;
You have 2 serious mistakes and 2 potential issues:
- Your
Idx start from 0, it is wrong.
- You compare the '
char' with 'A'..'Z', it is wrong.
- You should not
hardcode the value 4.
- You maybe forgot to initial the variable
Valid.
Note:
Programmers usually name the looping variable i. You don't have to but if you want to follow the common standard you should rename the variable Idx to i.
---edit---
Fix some typing mistakes.