I have this code:
var
ExtString: string;
const
Extensions : array[0..4] of string = ('.rar', '.zip', '.doc', '.jpg', '.gif');
if ExtString in Extensions then
On the last line, I get an error:
[DCC Error] E2015 Operator (‘then’) not applicable to this operand type
I think I can not do this, so how can I properly perform my task?
As you have found you can’t check for a String in an Array of String, using
in.You could use this function instead of the
ifstatement.You can call it like this.
if StrInArray(ExtString,Extensions) thenThe
StrUtils.pashas this already defined.