#1 2017-05-11 10:43

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

function FileReadLines: TAnsiStringArray - no Wide?

Hi Denis, about

ReNamer:Pascal_Script:Functions#File_Read/Write

function FileReadLines(const FileName: WideString): TAnsiStringArray;




Is that is correct that this is still a ANSI array?


I searched for such a function and I missed smtg like:
function FileReadLines(const FileName: WideString): TWideStringArray;

Is such perhaps planned, or is there a other way?

I have noticed FileReadText():WideString;
but I think a array would be nicer to work with?




I work on that "Load s&r pairs from file" script from the other thread from today.
http://www.den4b.com/forum/viewtopic.php?id=2307
 


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#2 2017-05-11 17:09

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,367

Re: function FileReadLines: TAnsiStringArray - no Wide?

FileReadLines returns TAnsiStringArray for backwards compatibility. It also doesn't handle any text encodings, unlike FileReadText.

We have two options:

1) Change the return type of FileReadLines to TWideStringArray, but break backwards compatibility.
2) Create another function like FileReadTextLines: TWideStringArray.

I am still deciding what's best in a long run...

Offline

#3 2017-05-12 09:47

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: function FileReadLines: TAnsiStringArray - no Wide?

Looks like the only way is to provide a new function to not break old scripts?

function FileReadLines(      const FileName: WideString): TAnsiStringArray; //Read all lines from a file FileName. Basic ANSI chars only.
function FileReadTextLines(const FileName: WideString): TWideStringArray;//Read all lines from a file FileName. Unicode string aware.





 


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#4 2017-05-12 14:31

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,367

Re: function FileReadLines: TAnsiStringArray - no Wide?

FileReadTextLines function will be added in v6.7.0.1 Beta.

Offline

#5 2017-05-27 08:34

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,367

Re: function FileReadLines: TAnsiStringArray - no Wide?

ReNamer v6.7.0.1 Beta is now available for download. It contains the new FileReadTextLines function.

Offline

Board footer

Powered by FluxBB