You are not logged in.
Pages: 1
Could IntegerDynArrayToCSV change it's behaviour so that the Prefix and Suffix are returned with an empty array?
It would need the following changes at line 22603 of SynCommons.pas:
function IntegerDynArrayToCSV(const Values: array of integer; ValuesCount: integer;
const Prefix: RawUTF8=''; const Suffix: RawUTF8=''): RawUTF8;
type
TInts16 = packed array[word] of string[15]; // shortstring are faster (no heap allocation)
var i, L, Len: PtrInt;
tmp: array[0..15] of AnsiChar;
ints: ^TInts16;
P: PAnsiChar;
begin
result := '';
if ValuesCount=0 then
exit;
...
to
function IntegerDynArrayToCSV(const Values: array of integer; ValuesCount: integer;
const Prefix: RawUTF8=''; const Suffix: RawUTF8=''): RawUTF8;
type
TInts16 = packed array[word] of string[15]; // shortstring are faster (no heap allocation)
var i, L, Len: PtrInt;
tmp: array[0..15] of AnsiChar;
ints: ^TInts16;
P: PAnsiChar;
begin
result := '';
if ValuesCount=0 then begin
result := Prefix + Suffix;
exit;
end;
...
The following Int64DynArrayToCSV function would need the same change for consistency.
Offline
It would break existing code, I'm afraid.
Use your own function, instead:
function EsmondIntegerDynArrayToCSV(const Values: array of integer; ValuesCount: integer;
const Prefix: RawUTF8=''; const Suffix: RawUTF8=''): RawUTF8;
begin
if ValuesCount=0 then begin
result := Prefix + Suffix else
result := IntegerDynArrayToCSV(Values,ValuesCount,Prefix,Suffix);
end;
Offline
Pages: 1