M
Markus Freitag
Guest
Hello,
What's the right way to do it?
Works, but maybe not the best way.
string t2 = countToAnaylse.Replace(".", "").Replace(",", "");
Nothing works.
My trials.
// -----------------------------------------------------------
string countToAnaylse = "7.765";
int helpCountMustBe = 0;
//CultureInfo.InvariantCulture
// helpCountMustBe = int.Parse(countToAnaylse, new CultureInfo("de-DE"));
NumberFormatInfo num = new NumberFormatInfo();
num.NumberDecimalSeparator = ",";
num.NumberGroupSeparator = "-"; // ".";
string t1 = String.Format(num, "{0}", countToAnaylse);
string t2 = countToAnaylse.Replace(".", "").Replace(",", "");
//try
//{
// helpCountMustBe = int.Parse(countToAnaylse, CultureInfo.InvariantCulture);
//}
//catch (Exception eCult)
//{
// Trace.Writeline($"{LOG}[Scan] '{eCult.Message}' ");
//}
//if (helpCountMustBe == 0)
//{
// helpCountMustBe = int.Parse(countToAnaylse, new CultureInfo("de-DE"));
//}
Best regards Markus
Continue reading...
What's the right way to do it?
Works, but maybe not the best way.
string t2 = countToAnaylse.Replace(".", "").Replace(",", "");
Nothing works.
My trials.
// -----------------------------------------------------------
string countToAnaylse = "7.765";
int helpCountMustBe = 0;
//CultureInfo.InvariantCulture
// helpCountMustBe = int.Parse(countToAnaylse, new CultureInfo("de-DE"));
NumberFormatInfo num = new NumberFormatInfo();
num.NumberDecimalSeparator = ",";
num.NumberGroupSeparator = "-"; // ".";
string t1 = String.Format(num, "{0}", countToAnaylse);
string t2 = countToAnaylse.Replace(".", "").Replace(",", "");
//try
//{
// helpCountMustBe = int.Parse(countToAnaylse, CultureInfo.InvariantCulture);
//}
//catch (Exception eCult)
//{
// Trace.Writeline($"{LOG}[Scan] '{eCult.Message}' ");
//}
//if (helpCountMustBe == 0)
//{
// helpCountMustBe = int.Parse(countToAnaylse, new CultureInfo("de-DE"));
//}
Best regards Markus
Continue reading...