octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: locale for scanf backed out


From: Pascal Dupuis
Subject: Re: locale for scanf backed out
Date: Tue, 26 Feb 2013 10:03:42 +0100

2013/2/26 Rik <address@hidden>:
> 2/25/13
>
> All,
>
> I backed out the locale changeset for scanf.  Unfortunately, due to issues
> in the build system you will need to manually remove
> libinterp/interpfcn/file-io.cc-tst before tests will pass.
>
> --Rik

Rik,

I find this a bit unfair. There was an agreement that supporting
locale on printf is not a good idea; nor implement something like
National Instruments extension to force the use of a decimal point.

OTOH, I can assure you that changing the locales used in a CSV file is
everything but easy. CSV files contains strings and numbers intermixed
by separators. What about separators and points and comma inside
strings ? What about string delimiter inside string like 'O''Reilly' ?
Some broken programs even quote every number !

The only sane way I found in the database package was
1) use strsplit() to decompose a line into fields
2) apply scant() onto each field. If it fails, try to detect a
date-time pattern.

As you can see, half the hard work is done inside strsplit, and we
have the power of Octave to store each substring into a cell. Doing it
from some external program implies to write  and debug a full strsplit
replacement.

Regards

Pascal


reply via email to

[Prev in Thread] Current Thread [Next in Thread]