Hello Support Team,
I am experiencing a syntax error in my script while using a case
statement. The objective of the script is to categorize characters in a string as letters, figures, spaces, or special characters. The syntax error occurs specifically at the case
statement. Here's the script:
var
metin: string;
karakter: Char;
index : Integer;
Begin
metin := 'SalI<ha12';
index := 1;
while (index <= Length(metin)) do
begin
karakter := metin[index];
case karakter of
'a'..'z', 'A'..'Z': ShowMessage(karakter+' is a letter.');
'0'..'9': ShowMessage(karakter +' is a figure.');
' ', #9, #10, #13: ShowMessage('A space or space-like character.');
else
ShowMessage(karakter+' is a special character.');
end;
Inc(index);
end;
end;
Could you please assist me in identifying the cause of the syntax error and suggest how I can correct it? If the case
statement isn't compatible with your scripting environment, what alternative construct can I use to achieve the same result?
Thank you for your help.