compile, function pos: wrong number of arguments lazarus / 21-General ---------------------------------------------------------------------- Matze · 2025-01-31 11:21 Hello, when i try to compile my code i get an error at function pos: Project compile, choice.exe: Exit code 1, Error: 50 choice.lpr(354,55) Error: Wrong number of parameters specified for call to "Pos" Error: Found declaration: Pos(const ShortString;const ShortString):LongInt; Error: Found declaration: Pos(Char;const ShortString):LongInt; Error: Found declaration: Pos(const ShortString;const RawByteString):LongInt; ... my source code is: if ((copy(Upcase(Parameter), 1, 2) = '/T') and (Pos('/D', Upcase(CMDzeile), 1) < 1)) or          (copy(Upcase(Parameter), 1, 2) = '/D') then         begin         ... I have 3 arguments for pos, but the error solution only requires 2 arguments? In the FPC compiler I can use 3 arguments. ---------- Lazarus 1.8.2 FPC 3.0.4 ---------------------------------------------------------------------- cdbc · 2025-01-31 11:37 Hi QuoteIn the FPC compiler I can use 3 arguments.The third param is default to 1, just leave it out, i.e.: 2 params only! Otherwise, I think you have to include 'StrUtils' in your uses clause... Regards Benny ---------------------------------------------------------------------- MarkMLl · 2025-01-31 11:41 The way to tackle something like that is to break your expression out into multiple lines and count parentheses carefully: ( (copy(Upcase(Parameter), 1, 2) = '/T') and (Pos('/D', Upcase(CMDzeile), 1) < 1) ) or          (copy(Upcase(Parameter), 1, 2) = '/D' ) Hence it appears that you might have a misplaced one before the or operator. Please use code tags for examples, if it had contained any square brackets it would have been mnagled. Please put your software versions in the body of the posting rather than in your sig, since it you ever update your sig all messages you've every posted will appear with the new one losing the context of each question. MarkMLl ---------------------------------------------------------------------- PascalDragon · 2025-02-02 20:26 Quote from: Matze on January 31, 2025, 12:21:41 pmLazarus 1.8.2 FPC 3.0.4 The 3-argument variant of Pos is only available from FPC 3.2 on. But as your call to Pos has that argument set to 1 you can simply remove that.