[Solved] Using "in" for array of string lazarus / 62-General ---------------------------------------------------------------------- AlexTP · 2021-08-14 19:24 Code Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$mode objfpc}{$H+}                       ...const  ar: array of string = ('a','b'); procedure TForm1.FormCreate(Sender: TObject);var  s: string;begin  s:= 'a';  if s in ar then ; end;  FPC error: "Operator is not overloaded". Lazarus 2.3.0 r65368M FPC 3.2.1 x86_64-linux-gtk2 When this "in" must work? ---------------------------------------------------------------------- AlexTP · 2021-08-14 19:50 Free Pascal Compiler version 3.2.1-r48494 [2021/02/02] for x86_64 ---------------------------------------------------------------------- Kays · 2021-08-14 20:01 Quote from: Alextp on August 14, 2021, 09:24:25 pm[…] When this "in" must work?Did you mean the following?Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i for s in ar do …The in operator as a Boolean test was never defined/overloaded for any array. Only for set data types you can check membership with in. ---------------------------------------------------------------------- MarkMLl · 2021-08-14 20:03 Quote from: Alextp on August 14, 2021, 09:24:25 pmWhen this "in" must work? When the second operand is a set. MarkMLl ---------------------------------------------------------------------- AlexTP · 2021-08-14 20:57 I mean  'in' for arrays. It worked in this Github snapshot: 1) https://github.com/Alexey- T/ATSynEdit_Cmp/blob/0522e13cc78975431b96ea307adf95f4aad08a21/atsynedi t_cmp/atsynedit_cmp_html.pas#L70 2) check with 'in' https://github.com/Alexey- T/ATSynEdit_Cmp/blob/0522e13cc78975431b96ea307adf95f4aad08a21/atsynedi t_cmp/atsynedit_cmp_html.pas#L646 ---------------------------------------------------------------------- Leledumbo · 2021-08-14 21:18 Quote from: Alextp on August 14, 2021, 10:57:57 pmI mean  'in' for arrays. It worked in this Github snapshot: 1) https://github.com/Alexey- T/ATSynEdit_Cmp/blob/0522e13cc78975431b96ea307adf95f4aad08a21/atsynedi t_cmp/atsynedit_cmp_html.pas#L70 2) check with 'in' https://github.com/Alexey- T/ATSynEdit_Cmp/blob/0522e13cc78975431b96ea307adf95f4aad08a21/atsynedi t_cmp/atsynedit_cmp_html.pas#L646 Add StrUtils to uses clause. ---------------------------------------------------------------------- simone · 2021-08-14 21:38 It is  documented here: https://www.freepascal.org/docs-html/rtl/strutils/op-in-string- boolean.html