我有這樣的代碼:如何檢查數組中是否存在字符串?
var
ExtString: string;
const
Extensions : array[0..4] of string = ('.rar', '.zip', '.doc', '.jpg', '.gif');
if ExtString in Extensions then
就上線,我得到一個錯誤:
[DCC Error] E2015 Operator ('then') not applicable to this operand type
我想我不能做到這一點,所以我怎麼能正確地執行我的任務?
**在**運算符不適用於這些操作數類型 – 2011-06-12 04:07:03
這是解釋爲什麼OP的嘗試不起作用,但它不是真正的答案,因爲問題是「我該如何正確執行此任務?」 – jpfollenius 2011-06-12 10:01:23
[查找字符串是否在列表中(沒有泛型)]的最佳方法](http://stackoverflow.com/questions/246623/best-way-to-find-if-a-string-is-不含泛型的列表) – 2016-12-01 22:25:58