Ticket UUID: | 1469593 | |||
Title: | csv - Add delimiter support beyond double-quotes | |||
Type: | Patch | Version: | None | |
Submitter: | nobody | Created on: | 2006-04-13 02:08:01 | |
Subsystem: | csv | Assigned To: | andreas_kupries | |
Priority: | 5 Medium | Severity: | ||
Status: | Deleted | Last Modified: | 2006-06-16 05:00:51 | |
Resolution: | Accepted | Closed By: | andreas_kupries | |
Closed on: | 2006-06-15 22:00:51 | |||
Description: |
The CSV package that comes with tcllib only accepts double-quotes as the delimiter character when parsing input data or when generating output. I have changed it to accept any character as delimiter. The delimiter can be specified as an optional extra argument. Sample: % package req csv % ### use single quote as delimiter % set line "1,'abc , def',ttt,20.5" % csv::split $line , ' 1 {abc , def} ttt 20.5 % ### join the list back again with @ as delimiter % ### and : as separator % set line2 [csv::join [csv::split $line , '] : \@] @1@:@abc , def@:@ttt@:@20.5@ % ### get back the original list % csv::split $line2 : @ 1 {abc , def} ttt 20.5 | |||
User Comments: |
andreas_kupries added on 2006-06-16 05:00:50:
Logged In: YES user_id=75003 Accepted, with small change in join, fixing the testsuite breakage. Extended testsuite and docs to cover the new functionality. andreas_kupries added on 2006-06-16 03:52:25: Logged In: YES user_id=75003 The attached changed implementation fails the testsuite. As the testsuite as is does not use the new functionality, the new code is breaking existing functionality. nobody added on 2006-04-13 09:08:02: File Added - 174409: csv-with-delim.tcl |
Attachments:
- csv-with-delim.tcl [download] added by nobody on 2006-04-13 09:08:02. [details]