Reputation: 11
I want to convert a double value into a string value, but when I am concatenating this string(double)
value, it is changing the .
to ,
and I can't manipulate this value. I tried to use String.Replace
but didn't work too.
What I can do in this case. Here is my Code.
object[] campos = new object[1];
campos[0] = (double)56.25566;
Parameters[1] = "gdinvdllo005.start.load.coleta.o(" + campos[0].ToString() + ")";
Upvotes: 1
Views: 198
Reputation: 460360
It seems that your current culture uses a comma as decimal separator but you want to force a point. Then you can use NumberFormatInfo.InvariantInfo
in double.ToString
:
double doubleValue = 56.25566;
string stringValue = doubleValue.ToString(NumberFormatInfo.InvariantInfo);
Parameters[1] = "gdinvdllo005.start.load.coleta.o(" + stringValue + ")";
Upvotes: 2
Reputation: 1503974
It sounds like your thread has a culture which uses "," as the decimal separator. The simplest approach is probably to call string.Format
specifying the invariant culture:
Parameters[1] = string.Format(
CultureInfo.InvariantCulture,
"gdinvdllo005.start.load.coleta.o({0})",
campos[0]);
Upvotes: 7