Re: [fpc-pascal] Is there a bug in TStrings.Delimiter handling?

2011-11-21 Thread Graeme Geldenhuys
On 2011-11-21 08:59, Frank Church wrote:
 adapterVals: TStringList
 
 adapterVals.Delimiter := ';';
 adapterVals.DelimitedText := '192.168.1.2,00:0E:08:E0:7C:ED,Word Space';

I take it this is a typo, and you ment to have the comma's as semi-colons.


 adapterVals[2] = 'Word' - this should be 'Word Space'
 
 Is this a bug or the expected output? If the delimiter is set to a comma it
 shouldn't treat a space as a delimter as well.

Sadly, this is the exact same output as given by Delphi 7. But that
still doesn't make it right (Delphi is not immune to bugs), and I don't
think FPC should start cloning Delphi bugs too. I read the Delphi 7
help, and there is no mention of special handling when a Space character
is involved in the DelimitedText value. So this sure looks like a bug to me.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Is there a bug in TStrings.Delimiter handling?

2011-11-21 Thread michael . vancanneyt



On Mon, 21 Nov 2011, Frank Church wrote:


adapterVals: TStringList

adapterVals.Delimiter := ';';
adapterVals.DelimitedText := '192.168.1.2,00:0E:08:E0:7C:ED,Word Space';
adapterVals[0] = '192.168.1.2'
adapterVals[1] = '00:0E:08:E0:7C:ED'
adapterVals[2] = 'Word' - this should be 'Word Space'

Is this a bug or the expected output? If the delimiter is set to a comma it
shouldn't treat a space as a delimter as well.


A space is always treated special.

You should either enclose values with spaces in quotes, or set the
StrinctDelimiter property to true, in which case the space loses 
its special meaning.


I recommend the second.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Is there a bug in TStrings.Delimiter handling?

2011-11-21 Thread Marco van de Voort
In our previous episode, Frank Church said:
 adapterVals: TStringList
 
 adapterVals.Delimiter := ';';
 adapterVals.DelimitedText := '192.168.1.2,00:0E:08:E0:7C:ED,Word Space';
 adapterVals[0] = '192.168.1.2'
 adapterVals[1] = '00:0E:08:E0:7C:ED'
 adapterVals[2] = 'Word' - this should be 'Word Space'
 
 Is this a bug or the expected output? If the delimiter is set to a comma it
 shouldn't treat a space as a delimter as well.

This is the expected output and delphi compatible.

Hint: set adapterVals.strictdelimiter:=true
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Is there a bug in TStrings.Delimiter handling?

2011-11-21 Thread michael . vancanneyt



On Mon, 21 Nov 2011, michael.vancann...@wisa.be wrote:




On Mon, 21 Nov 2011, Frank Church wrote:


adapterVals: TStringList

adapterVals.Delimiter := ';';
adapterVals.DelimitedText := '192.168.1.2,00:0E:08:E0:7C:ED,Word Space';
adapterVals[0] = '192.168.1.2'
adapterVals[1] = '00:0E:08:E0:7C:ED'
adapterVals[2] = 'Word' - this should be 'Word Space'

Is this a bug or the expected output? If the delimiter is set to a comma it
shouldn't treat a space as a delimter as well.


A space is always treated special.

You should either enclose values with spaces in quotes, or set the
StrinctDelimiter property to true, in which case the space loses its special 
meaning.


Typo, should be StrictDelimiter, of course.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Is there a bug in TStrings.Delimiter handling?

2011-11-21 Thread Graeme Geldenhuys
On 2011-11-21 10:28, michael.vancann...@wisa.be wrote:
 
 A space is always treated special.

Where in the Delphi documentation does it mention that?  I couldn't find
any such reference in the Delphi 7 docs, and I thought FPC implements
behaviour based on documented behaviour, not implementation behaviour?

And does FPC implement Delphi bugs too? If so, that is sad.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Is there a bug in TStrings.Delimiter handling?

2011-11-21 Thread michael . vancanneyt



On Mon, 21 Nov 2011, Graeme Geldenhuys wrote:


On 2011-11-21 10:28, michael.vancann...@wisa.be wrote:


A space is always treated special.


Where in the Delphi documentation does it mention that?  I couldn't find
any such reference in the Delphi 7 docs, and I thought FPC implements
behaviour based on documented behaviour, not implementation behaviour?


Sure. See the 'CommaText' help.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Is there a bug in TStrings.Delimiter handling?

2011-11-21 Thread Graeme Geldenhuys
On 2011-11-21 11:17, michael.vancanneyt@w. wrote:
 Where in the Delphi documentation does it mention that?  I couldn't find
 any such reference in the Delphi 7 docs, and I thought FPC implements
 behaviour based on documented behaviour, not implementation behaviour?
 
 Sure. See the 'CommaText' help.

Sure, that is the help for CommaText, not the help for Delimiter or
DelimitedText. In the latter documentation it makes no mention of SDF
(System Data Format) format usage - which apparently has the Comma or
Space character requirement.

DelimitedText docs say:  individual strings are separated by the
character specified by the Delimiter property.

I guess this boils down to the interpretation of the Delphi
documentation then.

Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Is there a bug in TStrings.Delimiter handling?

2011-11-21 Thread michael . vancanneyt



On Mon, 21 Nov 2011, Graeme Geldenhuys wrote:


On 2011-11-21 11:17, michael.vancanneyt@w. wrote:

Where in the Delphi documentation does it mention that?  I couldn't find
any such reference in the Delphi 7 docs, and I thought FPC implements
behaviour based on documented behaviour, not implementation behaviour?


Sure. See the 'CommaText' help.


Sure, that is the help for CommaText, not the help for Delimiter or
DelimitedText. In the latter documentation it makes no mention of SDF
(System Data Format) format usage - which apparently has the Comma or
Space character requirement.

DelimitedText docs say:  individual strings are separated by the
character specified by the Delimiter property.

I guess this boils down to the interpretation of the Delphi
documentation then.


In my opinion, the Delphi documentation is quite explicit:

---
When writing DelimitedText, individual strings must be separated using
QuoteChar at both ends, using Delimiter as a separator, or using both these
methods.

Note:   CommaText is the same as the DelimitedText property when Delimiter
is ',' and QuoteChar is ''.
---

The first paragraph indicate that in fact you should always use  around your
values.

And the last sentence should prompt anyone to go and read the CommaText
docs.

But we're not here to discuss the merits/disadvantages of the Delphi docs :-)

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Is there a bug in TStrings.Delimiter handling?

2011-11-21 Thread Graeme Geldenhuys
On 2011-11-21 12:06, michael.vancann...@wisa.be wrote:
 
 But we're not here to discuss the merits/disadvantages of the Delphi
 docs :-)

Indeed. I double checked the FPC documentation, and it is perfectly
clear and simple to understand. Makes me wonder why I even bothered to
read the Delphi docs. :)



Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Is there a bug in TStrings.Delimiter handling?

2011-11-21 Thread Frank Church
On 21 November 2011 10:06, michael.vancann...@wisa.be wrote:



 On Mon, 21 Nov 2011, Graeme Geldenhuys wrote:

  On 2011-11-21 11:17, michael.vancanneyt@w. wrote:

 Where in the Delphi documentation does it mention that?  I couldn't find
 any such reference in the Delphi 7 docs, and I thought FPC implements
 behaviour based on documented behaviour, not implementation behaviour?


 Sure. See the 'CommaText' help.


 Sure, that is the help for CommaText, not the help for Delimiter or
 DelimitedText. In the latter documentation it makes no mention of SDF
 (System Data Format) format usage - which apparently has the Comma or
 Space character requirement.

 DelimitedText docs say:  individual strings are separated by the
 character specified by the Delimiter property.

 I guess this boils down to the interpretation of the Delphi
 documentation then.


 In my opinion, the Delphi documentation is quite explicit:

 --**--**
 ---
 When writing DelimitedText, individual strings must be separated using
 QuoteChar at both ends, using Delimiter as a separator, or using both these
 methods.

 Note:   CommaText is the same as the DelimitedText property when Delimiter
 is ',' and QuoteChar is ''.
 --**--**
 ---

 The first paragraph indicate that in fact you should always use  around
 your
 values.

 And the last sentence should prompt anyone to go and read the CommaText
 docs.


This is one of the things concocted to make life difficult for programmers[?].
In my view if the docs are not explicit about space being treated
specially, then it shouldn't be treated specially, but such are the
conventions in the programming world.


 But we're not here to discuss the merits/disadvantages of the Delphi docs
 :-)

 Michael.

 __**_
 fpc-pascal maillist  -  
 fpc-pascal@lists.freepascal.**orgfpc-pascal@lists.freepascal.org
 http://lists.freepascal.org/**mailman/listinfo/fpc-pascalhttp://lists.freepascal.org/mailman/listinfo/fpc-pascal




-- 
Frank Church

===
http://devblog.brahmancreations.com
330.gif___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal