You are here: Re: how to find seperator in a csv-file « All PHP « IT news, forums, messages
Re: how to find seperator in a csv-file

Posted by Oli Filth on 01/10/06 16:20

nescio said the following on 10/01/2006 12:40:
>>>but i want to check if the delimiter they choose is the same as in the
>>>csv-file)
>>
>>I guess you could call fgetcsv() with the specified delimiter, and if
>>it returns FALSE then you know it didn't work.
>
> yes, that could be done, but if the specified delimiter is wrong but the
> sign appears in the first line
> it will return true, isn't it?
>
> lets say they choose the sign '^', and in the csv-file the first line is:
> "232";"4^dfd";"232323"
> the return will be 'true', or am i mistaken?
>

Well, if the CSV is equally valid with two different delimiters, then
there's nothing you can do.

The best you could hope to do is validate the data itself, e.g. ensure
that there's a set number of fields per line, that each field is of the
correct format, etc.

--
Oli

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация