synce1234 / aforge

Automatically exported from code.google.com/p/aforge
0 stars 0 forks source link

Parsing decimal numbers in InvariantCulture #37

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
== Situation ==
Many samples such as Neuro\Back Propagation\Approximation read a .csv file
and parse decimal numbers, which are formatted with a colon '.' as the
decimal separator.

== Problem ==
In the regional settings of many countries (e.g. most European countries,
Russia, South America...), a comma ',' is used as a decimal separator, and
not a colon '.'
In those countries, the samples parsing decimal numbers fail to load the
.csv file.

== Solution ==
Use for instance CultureInfo.InvariantCulture when parsing those numbers.

=== Code ===
using System.Globalization;
...
double.Parse( strs[0], CultureInfo.InvariantCulture );

Original issue reported on code.google.com by alexandre.alapetite on 17 Nov 2007 at 11:04

GoogleCodeExporter commented 8 years ago

Original comment by andrew.k...@gmail.com on 21 Nov 2007 at 8:48