diff --git a/src/Data/Text/DelimitedReader.cs b/src/Data/Text/DelimitedReader.cs
index 7170b812..0c5eda59 100644
--- a/src/Data/Text/DelimitedReader.cs
+++ b/src/Data/Text/DelimitedReader.cs
@@ -45,7 +45,7 @@ namespace MathNet.Numerics.Data.Text
/// specify a delimiter, then any whitespace is used.
///
public static class DelimitedReader
- {
+ {
///
/// The base regular expression.
///
@@ -77,10 +77,10 @@ namespace MathNet.Numerics.Data.Text
{
delimiter = CleanDelimiter(delimiter);
var mv = missingValue ?? NaN();
- var mvStr = mv.ToString();
-
- var regex = delimiter == @"\s" ?
- RegexCache.GetOrAdd(delimiter, d => new Regex(WhiteSpaceRegexTemplate, RegexOptions.Compiled)) :
+ var mvStr = mv.ToString("G", formatProvider);
+
+ var regex = delimiter == @"\s" ?
+ RegexCache.GetOrAdd(delimiter, d => new Regex(WhiteSpaceRegexTemplate, RegexOptions.Compiled)) :
RegexCache.GetOrAdd(delimiter, d => new Regex(string.Format(RegexTemplate, d), RegexOptions.Compiled));
var data = new List();
@@ -117,9 +117,9 @@ namespace MathNet.Numerics.Data.Text
}
else
{
- var offset = 0;
- var row = new List();
-
+ var offset = 0;
+ var row = new List();
+
foreach (var value in (from Match match in matches where match.Length > 0 select match.Value))
{
var delimterCount = value.StartsWith(delimiter) ? value.CountDelimiters(delimiter) : 0;
@@ -197,7 +197,7 @@ namespace MathNet.Numerics.Data.Text
/// The value to represent missing values. Default: NaN.
/// A matrix containing the data from the .
/// The data type of the Matrix. It can be either: double, float, Complex, or Complex32.
- public static Matrix Read(Stream stream, bool sparse = false, string delimiter = @"\s", bool hasHeaders = false, IFormatProvider formatProvider = null, T? missingValue=null)
+ public static Matrix Read(Stream stream, bool sparse = false, string delimiter = @"\s", bool hasHeaders = false, IFormatProvider formatProvider = null, T? missingValue = null)
where T : struct, IEquatable, IFormattable
{
using (var reader = new StreamReader(stream))
@@ -209,7 +209,7 @@ namespace MathNet.Numerics.Data.Text
///
/// NaN for the given numeric type.
///
- private static T NaN()
+ static T NaN()
{
if (typeof (T) == typeof (double))
{
@@ -262,7 +262,7 @@ namespace MathNet.Numerics.Data.Text
///
/// Counts the number of delimiters in a row.
///
- private static int CountDelimiters(this string obj, string demlimiter)
+ static int CountDelimiters(this string obj, string demlimiter)
{
var pos = 0;
var count = 0;
@@ -274,12 +274,12 @@ namespace MathNet.Numerics.Data.Text
}
return count;
- }
+ }
///
- /// Returns a regex friendly delimter.
+ /// Returns a regex friendly delimiter.
///
- private static string CleanDelimiter(string delimiter)
+ static string CleanDelimiter(string delimiter)
{
if (string.IsNullOrEmpty(delimiter))
{
@@ -287,9 +287,9 @@ namespace MathNet.Numerics.Data.Text
}
switch (delimiter)
{
- case "." :
+ case ".":
return "\\.";
- case "\\" :
+ case "\\":
return "\\\\";
default:
return delimiter;
diff --git a/src/Data/Text/DelimitedWriter.cs b/src/Data/Text/DelimitedWriter.cs
index 198cb52a..54f9611f 100644
--- a/src/Data/Text/DelimitedWriter.cs
+++ b/src/Data/Text/DelimitedWriter.cs
@@ -50,7 +50,7 @@ namespace MathNet.Numerics.Data.Text
/// Custom column header. Headers are only written if non-null and non-empty headers are provided. Default: null.
/// The number format to use on each element. Default: null.
/// The culture to use. Default: null.
- /// A value that represents a missing value. If not null, then elemements of the matrix that have this value
+ /// A value that represents a missing value. If not null, then elements of the matrix that have this value
/// are not written to the output file.
/// If either or is null.
/// The data type of the Matrix. It can be either: Double, Single, Complex, or Complex32.
@@ -103,7 +103,7 @@ namespace MathNet.Numerics.Data.Text
else
{
var missing = missingValue.Value;
-
+
for (var i = 0; i < matrix.RowCount; i++)
{
for (var j = 0; j < matrix.ColumnCount; j++)
@@ -136,7 +136,7 @@ namespace MathNet.Numerics.Data.Text
/// Custom column header. Headers are only written if non-null and non-empty headers are provided. Default: null.
/// The number format to use on each element. Default: null.
/// The culture to use. Default: null.
- /// A value that represents a missing value. If not null, then elemements of the matrix that have this value
+ /// A value that represents a missing value. If not null, then elements of the matrix that have this value
/// are not written to the output file.
/// If either or is null.
/// The data type of the Matrix. It can be either: Double, Single, Complex, or Complex32.
@@ -158,7 +158,7 @@ namespace MathNet.Numerics.Data.Text
/// Custom column header. Headers are only written if non-null and non-empty headers are provided. Default: null.
/// The number format to use on each element. Default: null.
/// The culture to use. Default: null.
- /// A value that represents a missing value. If not null, then elemements of the matrix that have this value
+ /// A value that represents a missing value. If not null, then elements of the matrix that have this value
/// are not written to the output file.
/// If either or is null.
/// The data type of the Matrix. It can be either: Double, Single, Complex, or Complex32.