Hi,
I have tried to find out how to format a string with numbers like this:
string a = “1000” => 1.000
string b = “10000” => 10.000
string c = “100000” => 100.000
etc…
Is there anyone here that can help me how to achieve this?
Hi,
I have tried to find out how to format a string with numbers like this:
string a = “1000” => 1.000
string b = “10000” => 10.000
string c = “100000” => 100.000
etc…
Is there anyone here that can help me how to achieve this?
Pretty sure this is what you want? ![]()
Sorry, that was a partially hasty response: The link I provided is for numbers to string.
Not sure of string to string, off-hand.
You could convert to string (from int) and back, again, if nothing else.
Are you wanting decimals or commas? You put decimals in your example, but wanted to make sure you didn’t want commas instead.
That might be a … um, “regional” thing?
* locale
decimals
You could always just do this
string a = "10000";
if (a.Length > 3)
a = a.Insert(a.Length - 3, ".");
I would probably make it into a method that you can pass a string to and return a string, but I don’t know much of your use case.
I think they’re asking if the decimal means the same thing a comma does in the states.
In the states one thousand and half is written 1,000.5
In places like France though, the comma delimits the fractional from the integer, and they use spaces to separate groupings of 3, and the comma as the radix.
1 000,5 = one thousand and a half
And, I don’t know what countries it is, and it may really be a hardware thing rather than a cultural thing… but I’ve seen the period used in stead to separate groupings.
Anyways…
The point is as described the formatting is ambiguous. What are you intended to do?
Like what would the value “1234” result in?
Are you attempting to move the radix? Are you trying to format for groupings in some cultural sense? What’s the rule you’re attempting to follow?
Cause as it stands, reading this as an US English speaker, it appears you’re asking for the value divided by 1000.