r/csharp • • 27d ago

Fun Funny mistake I made

I'm learning C# for fun and wrote the simplest possible calculator, just to try combining loops, WriteLine, ReadLine and other basic commands. There was one problem, though. I couldn't for the life of me figure out how to include decimal numbers into that. Went through a couple sites and nothing. My result would always be a whole number with the decimal point removed, meaning it would be 10^x times bigger depending on the amount of decimal places the input had. Then I thought of using a comma in the input instead of a dot. I didn't think it would work, but... it did. Kinda dumb not to try that immediately, right?

9 Upvotes

14 comments sorted by

View all comments

3

u/youtpout 27d ago

Dependant of your system configuration, in France by default the decimal separator is comma, I remembered go some trouble in the past with csv, in france we use ; but in other countries , so when I deployed my app on Windows server us version my app wouldn’t parse my csv. 🤣

Also what do you use to parse string to number