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"));
//}
![1492217.jpg 1492217.jpg](https://www.computerhelp.forum/data/attachments/56/56686-ad1aefe4fe69d1fdc17582a0ce7e0a16.jpg?hash=rRrv5P5p0f)
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"));
//}
![1492217.jpg 1492217.jpg](https://www.computerhelp.forum/data/attachments/56/56686-ad1aefe4fe69d1fdc17582a0ce7e0a16.jpg?hash=rRrv5P5p0f)
Best regards Markus
Continue reading...