I have a number like 202667.4
. I want to convert this to number based on culture.
For Ex:
In "de"(German) the number should be in 202.667,40.
Any help will be greatly appreciated.
Thanks.
I have a number like 202667.4
. I want to convert this to number based on culture.
For Ex:
In "de"(German) the number should be in 202.667,40.
Any help will be greatly appreciated.
Thanks.
If you want to represent existing number (say,
double
) in culture specific format, try formatting:https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings
Outcome
If you are given a
string
and you want a number, putParse
(TryParse
):If you don't want to specify the culture each time you work with formatting, you can set the culture as a current one:
You can use Culture info while parsing number into German format
Try with this approach:
for example:
neccesary transformation,
You can use this code to convert variables to different cultures:
If you want to build all programs with a German format you can this code at your main class: