#1 2017-07-23 22:02:48

mariomoretti
Member
From: italy
Registered: 2012-01-29
Posts: 88

tSynNameValue method's default options

tSynNameValue in syncommons has these two methods:

 procedure InitFromCSV(CSV: PUTF8Char; NameValueSep: AnsiChar='=';
      ItemSep: AnsiChar=#10);

and

    function AsCSV(const KeySeparator: RawUtf8='=';
      const ValueSeparator: RawUtf8=#13#10; const IgnoreKey: RawUTF8=''): RawUTF8;

are there reasons to maintain  different default values for itemsep , or is it possible to uniform them ?

tx

Offline

#2 2017-07-24 07:35:29

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: tSynNameValue method's default options

Fair point.

I've modified TSynNameValue.InitFromCSV and TDocVariantData.InitCSV methods so that ItemSep=#10 will in fact handle both #10 and #13#10 the same way, with the benefit of being cross-platform, whatever the line feed is used on the system.
See https://synopse.info/fossil/info/316e6aafbf

So, both methods should now have the same default behavior.

Offline

#3 2017-07-25 10:20:41

mariomoretti
Member
From: italy
Registered: 2012-01-29
Posts: 88

Re: tSynNameValue method's default options

Tx AB,
now it works fine.

My problem was that, with default behavior,  string values containing only digits inserted with asCSV, were returned by initfromcsv with a #13 added at the end. 

1 was returned as 1#13.

Offline

Board footer

Powered by FluxBB