C
C#2y ago
Norvik

double.Parse(3.5).ToString() returns 35

I got confused troubleshooting since web results didnt help, so i asked chatgpt and his code snippet returned the same
3 Replies
Norvik
NorvikOP2y ago
console returns harold
string word = "3.5";
double value = double.Parse(word);
Console.WriteLine(value.ToString() + " q " + word);
string word = "3.5";
double value = double.Parse(word);
Console.WriteLine(value.ToString() + " q " + word);
is the snippet
MODiX
MODiX2y ago
Retax#0813
REPL Result: Success
string word = "3.5";
double value = double.Parse(word, CultureInfo.GetCultureInfo("de-De"));
Console.WriteLine(value.ToString() + " q " + word);
string word = "3.5";
double value = double.Parse(word, CultureInfo.GetCultureInfo("de-De"));
Console.WriteLine(value.ToString() + " q " + word);
Console Output
35 q 3.5
35 q 3.5
Compile: 540.740ms | Execution: 39.095ms | React with ❌ to remove this embed.
Norvik
NorvikOP2y ago
Oh... It now adds up since 3,5 would work just fine It all makes sense now thanks
Want results from more Discord servers?
Add your server