On Thu, 16 Sep 2021, Bart via fpc-pascal wrote:

Hi,

I must be missing something obvious.
But given the following definition of the Split() helper function for strings:

Function Split(const Separators: array of Char; Options:
TStringSplitOptions): TStringArray; overload; (fpc 3.2.2)

Why does this not compile:

var
 SA: TStringArray;
 ...
 SA := S.Split([#0..#32],TStringSplitOptions.ExcludeEmpty);

You are passing not an array of char but a set of char.

This works:

SA := S.Split(#0#32,TStringSplitOptions.ExcludeEmpty);

An array of char is a string.

But the message is indeed confusing. My guess is that the compiler decided
it was this overload;

function TStringHelper.Split( const Separators: array of Char;
  AQuote: Char
):TStringArray; overload;

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to