Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2021-11

ExtractStrings by line in Windows

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Hairy Pixels

On Mac I had used ExtractStrings([LineEnding], [], str, list); to split a string by line but on Windows LineEnding is 2 chars long so the char set parameter doesn't work.

What is the solution to this on Windows?

Bart
to Hairy Pixels

On Wed, Nov 3, 2021 at 1:57 PM Hairy Pixels via fpc-pascal wrote:

Maybe use SomeString.Split([LineEnding'], ...)?
Split has an overload that takes an array of string as first paramter.

Bart
Ryan Joseph
to Bart
On Nov 3, 2021, at 8:17 PM, Bart via fpc-pascal wrote: Maybe use SomeString.Split([LineEnding'], ...)? Split has an overload that takes an array of string as first paramter.

Thanks, I guess I need to use a different way to work on all platforms.

Regards,
Ryan Joseph

Bart
to Ryan Joseph
PM Ryan Joseph wrote
> Maybe use SomeString.Split([LineEnding'], ...)? > Split has an overload that takes an array of string as first paramter. Thanks, I guess I need to use a different way to work on all platforms.

If you cast LineEnding to a string, it should work on all platforms I guess (since it invokes the overload with the array of string as separatorlist).

Bart