Best way to parse float?

后端 未结 10 1082
无人及你
无人及你 2020-12-02 22:52

What is the best way to parse a float in CSharp? I know about TryParse, but what I\'m particularly wondering about is dots, commas etc.

I\'m having problems with my

10条回答
  •  一向
    一向 (楼主)
    2020-12-02 22:56

    The source is an input from a website. I can't rely on it being valid. So I went with TryParse as mentioned before. But I can't figure out how to give the currentCulture to it.

    Also, this would give me the culture of the server it's currently running on, but since it's the world wide web, the user can be from anywhere...

提交回复
热议问题