Yeah I looked at that. I just wondered if there was a standard for csv files.
Rob Martin Software Engineer phone 03 377 0495 fax 03 377 0496 web www.chreos.com ----- Original Message ----- From: "Paul Mckenzie" <[EMAIL PROTECTED]> To: "NZ Borland Developers Group - Delphi List" <[EMAIL PROTECTED]> Sent: Tuesday, February 03, 2004 9:02 AM Subject: Re: [DUG] CSV > This is from the Help... > Note the mention of the SDF: > "For SDF format, strings are separated by commas or spaces, and optionally > enclosed in double quotes." > > CommaText > Lists the strings in the TStrings object in system data format (SDF). > > property CommaText: string; > > > Description > > Use CommaText to get or set all the strings in the TStrings object in a > single comma-delimited string. > > When retrieving CommaText, any string in the list that include spaces, > commas or quotes will be contained in double quotes, and any double quotes > in a string will be repeated. For example, if the list contains the > following strings: > > Stri,ng 1 > > Stri"ng 2 > String 3 > String4 > > CommaText will return: > > "Stri,ng 1","Stri""ng 2","String 3",String4 > > When assigning CommaText, the value is parsed as SDF formatted text. For SDF > format, strings are separated by commas or spaces, and optionally enclosed > in double quotes. Double quote marks that are part of the string are > repeated to distinguish them from the quotes that surround the string. > Spaces and commas that are not contained within double quote marks are > delimiters. Two commas next to each other will indicate an empty string, but > spaces that appear next to another delimiter are ignored. For example, > suppose CommaText is set to: > > "Stri,ng 1", "Stri""ng 2" , String 3,String4 > > The list will then contain: > > Stri,ng 1 > > Stri"ng 2 > String > 3 > String4 > > Note: CommaText is the same as the DelimitedText property with a delimiter > of ',' and a quote character of '"'. > > Including a trailing comma in the source string causes a blank item to be > included in the string list. For example, if CommaText is set to > > "String1, String 2, String 3," > > the string list will contain' > > String1 > > String2 > String3 > <Blank> > > Regards > Paul McKenzie > Analyst Programmer > SMSS Ltd. > > ----- Original Message ----- > From: "Robert martin" <[EMAIL PROTECTED]> > To: "NZ Borland Developers Group - Delphi List" <[EMAIL PROTECTED]> > Sent: Tuesday, February 03, 2004 8:42 AM > Subject: Re: [DUG] CSV > > > > Thanks Peter > > > > I already have the code to handle the display so I may just make it that > the > > csv files need to have such fields enclosed in double quotes. > > > > Rob Martin > > Software Engineer > > > > phone 03 377 0495 > > fax 03 377 0496 > > web www.chreos.com > > ----- Original Message ----- > > From: <[EMAIL PROTECTED]> > > To: "NZ Borland Developers Group - Delphi List" <[EMAIL PROTECTED]> > > Sent: Monday, February 02, 2004 5:28 PM > > Subject: Re: [DUG] CSV > > > > > > > Stringlist.Commatext definitely handles spaces as you describe, and > > > always has. So you can't rely on it if your data is coming in in that > > > format. An alternate process might be to associate a TClientDataset > > > with your CSV file; though I haven't done it, I believe this will > > > provide seamless DB-style access ok. > > > > > > (Personally, if I were generating a CSV file, I'd always quote any > > > text field, as it *might* contain a comma. But I don't know of any > > > black-and-white standard mandating that). > > > > > > > Hi all > > > > > > > > I have been working with the CommaText method of a stringlist to > import > > a csv file. One of my test files does not use double quotes around fields > > containing spaces, the CommaText method splits the field into multiple > > fields. > > > > > > > > I thought double quotes were only required around fields containing > > commas. Does anyone know which format is the 'Official' format. If the > > CommaText method does not function correctly I will right my own (unless > > anyone has other suggestions). > > > > > > > > > > > > Rob Martin > > > > Software Engineer > > > > > > > > phone 03 377 0495 > > > > fax 03 377 0496 > > > > web www.chreos.com > > > > > > > > > cheers, > > > peter > > > > > > =========================================== > > > Peter Hyde, Development Director, SPIS Ltd, Christchurch, New Zealand > > > * TCompress/TCompLHA component sets for Delphi/Kylix/C++ > > > * TurboNote+: http://TurboNote.com -- top-rated onscreen sticky notes > > > Find all the above and MORE at http://spis.co.nz > > > > > > > > > _______________________________________________ > > > Delphi mailing list > > > [EMAIL PROTECTED] > > > http://ns3.123.co.nz/mailman/listinfo/delphi > > > > > > > > > > _______________________________________________ > > Delphi mailing list > > [EMAIL PROTECTED] > > http://ns3.123.co.nz/mailman/listinfo/delphi > > > _______________________________________________ > Delphi mailing list > [EMAIL PROTECTED] > http://ns3.123.co.nz/mailman/listinfo/delphi > > _______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
