some sec fixes
This commit is contained in:
@@ -3,12 +3,13 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Lab
|
||||
{
|
||||
internal class Parsers
|
||||
{
|
||||
public static bool TryParseDouble(string? s, out double val) => double.TryParse((s ?? "").Trim().Replace(",", "."), out val);
|
||||
public static bool TryParseDouble(string? s, out double val) => double.TryParse((s ?? "").Trim().Replace(",", "."), NumberStyles.Float, CultureInfo.InvariantCulture, out val) && !double.IsNaN(val) && !double.IsInfinity(val);
|
||||
public static bool TryParseInt(string? s, out int val) => int.TryParse((s ?? "").Trim(), out val);
|
||||
|
||||
public static bool TryParseDoubleArray(string? s, out double[] vals, out string err)
|
||||
@@ -21,7 +22,7 @@ namespace Lab
|
||||
return false;
|
||||
}
|
||||
|
||||
string[] parts = s.Split(new[] { ' ', '\t', '\n', '\r', ',', ';' });
|
||||
string[] parts = s.Split(new[] { ' ', '\t', '\n', '\r', ',', ';' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
List<double> list = new List<double>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user