Are there cultures in which the decimal separator is longer than one character?
Asked Answered
L

1

2

I must write a stringToNumber parsing function that can use custom strings for the following:

  • decimal separator (. for en-US => 3.1415)
  • thousands separator (, for en-US => 1,000,000)
  • positive sign (+ for en-US => +5)
  • negative sign (- for en-US => -5)

Can I assume that these are only one character (which would make the implementation easier) or are there any cultures in which any of these are longer?

Lentissimo answered 3/10, 2017 at 7:6 Comment(3)
By 'one character' are you referring to the '.', ',', '+' and '-'? And are you asking if these are ever repeated more than once in a number format?Askins
I mean if these can be longer than one character. Like a culture in which you need to specify two dots to indicate the decimal separator. Like this for example: 10..00Embolectomy
You seem to be dealing specifically with the en-US culture. I've worked on a number of US, UK, Canadian, South African, etc. based projects and I've never seen any variation where more than one character is used. The only variation I can think of is '-' where in accounting '-5' might be presented as (5).Askins
H
2

I wanted to know this as well, and found that I could do this:

foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
{
    var sep = ci.NumberFormat.NumberDecimalSeparator;
    if (sep.Length > 1)
    {
        Console.WriteLine(ci.DisplayName);
        break;
    }
}

The results of this is that, no, there is no culture where the NumberDecimalSeparator is greater than 1 character in length. You can also experiment with CurrencyDecimalSeparator and find the same results. I suppose you can check all of them, which I didn't but that's up to you.

Hamitic answered 29/3, 2023 at 14:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.