[fpc-devel] Some new
Michael Van Canneyt
michael at freepascal.org
Tue Mar 5 10:05:35 CET 2019
On Tue, 5 Mar 2019, J. Gareth Moreton wrote:
> Ah, okay. In my case, it doesn't work if the set you specify is a
> constant or variable defined elsewhere.
> const Delimiters: array[0..5] of Char = [#9, #10, #12, #13, #26, #32];
> if C in Delimiters then...
> If you do that, you get a compiler error about 'in' not being overloaded
> or some such.
That's because you're defining an array, not a set.
To define it as a set do:
Delimiters = [#9, #10, #12, #13, #26, #32];
Your c in delimiters will work because this is a set.
The FPC source tree is full of such constructs.
The sysutils unit has CharInSet() BTW, if you want to use an array.
More information about the fpc-devel