TextInputStream csv

Hi
Who i can split the ReadLine by “,” so i can save each data real in database fields

Have you searched this forum? https://forum.xojo.com/22985-csv-converter

Or
https://forum.xojo.com/21447-sorting-through-data-in-csv-file

I saw many different csv files and the most V? I saw was one with “on demand” quote surrounding

I mean, when needed (by the authors judgement), he adds a pair of surrounding quotes and let the other defined columns without. Something like:

True,1,"This is a nice csv row",Yellow,Business

And the surrounding quotes can appears everywhere in the columns

Who said Life is Easy ?

So, beware, and look for as many different csv files as you can grab from everywhere (including the internet). :wink:

Norman said once that every csv file is different from the others …
csv is the worst file to import, and you never can affirm that you import any csv file …

That is why I generally use Tab separated.

as I often import text paragraphs from databases to another, I often use chr(1) as field separator and chr(2) as record separator.
that way, I can handle texts with chr(9) or chr(13) inside.( and even ", etc)

[quote]as I often import text paragraphs from databases to another, I often use chr(1) as field separator and chr(2) as record separator.
that way, I can handle texts with chr(9) or chr(13) inside.( and even ", etc)[/quote]

If you have control of the data, you don’t even need to use a delimited file.
You can use JSON or XML or binary if you like.

The problem arises when someone says ‘I will send you a CSV file’
You have no control over that. (Heck, sometimes it isnt even a CSV file they send! )

Interesting read here:

https://ronaldduncan.wordpress.com/2009/10/31/text-file-formats-ascii-delimited-text-not-csv-or-tab-delimited-text/

[quote=275493:@Jeff Tullin]If you have control of the data, you don’t even need to use a delimited file.
You can use JSON or XML or binary if you like.

The problem arises when someone says ‘I will send you a CSV file’
You have no control over that. (Heck, sometimes it isnt even a CSV file they send! )[/quote]
what happens if you have a closing tag in the text of the JSON or XML you try to import ? it hangs.
with chr(1) and chr(2) it’s quite impossible that someone writes it in a text area

The characters need to be escaped.

Again, fine if you have control of the file. You can do anything if YOU have control of the creation of the file.
Most programming is in the situation where ‘you’ do not.

Tanner’s article is interesting.
But for that and your suggestion of chr(1) and chr(2) … how would a person create such a file using a text editor?

CSV files are popular because people can open them, see them, amend them easily.
Thats not so true of XML, JSON, and certainly not the case for Chr(1) and Chr(2)

Not saying you are wrong; use that method all you like.
But we cannot force the suppliers of data to provide data in that format.

[quote]Jean-Yves Pochez
Norman said once that every csv file is different from the others …[/quote]
… and he is right.

http://www.great-white-software.com/REALbasic_Code.html

grab the csv parser and be done with it

Even with the necessary evil that are ISO (and others), we can fall into traps (bad ISO implementation for example).

And ordinary people (but not only) have strange beliefs… A friend of mine told me he have converted a m4a (a video file) file to avi… I asked how and the answer was: I changed the file extension…

And I do not talk about cbr, cbz, cb7 and their brothers/sisters ! They, in fact, are holding rar, zip and 7z compressed data, only the extension have been changed. RIP.

I am unsure that I was clear on what I wanted to say:

the most important thing is file Read/Write compatibility. “All” applications have to be able to read the csv files (as in our example).

Who is stupid enough to share images with “.webp” extension ? (they are webp files using the “.webp” extension, not another more or less know image file format). [This recalls me people who shared music with .ape as file extensions…]