In the code I found the following construction

var nfi = (NumberFormatInfo)CultureInfo.CurrentCulture.NumberFormat.Clone(); nfi.NumberGroupSeparator = " "; item.ToString("#,0.00", nfi); 

But nowhere can I find it as "decrypted" the format "#,0.00" (experimentally, of course, established that it formats a number into a string with two decimal places or two zeros if the number is integer). But I would like to see a complete list of decryption rules.

  • four
  • @Grundy: Why not as an answer? Well, yes, the link, but better and more relevant than in MSDN, it will not be the same. - VladD
  • @VladD, yes, I was going to, then I thought that the link, then I was going again and eventually forgot :-) - Grundy
  • Thank you, apparently looking for the wrong keywords - e1s
  • @VladD, now I will add :-) done - Grundy

1 answer 1

The full table of symbols used in custom formats is given in MSDN.

Specifically in this case are used

  • "," - group separator and number scaling descriptor - is used both as a group separator and as a number scaling descriptor .

    • Group separator : if between two placeholders for digits ("0" or "#"), specifying the formatting of the integer part of a number, is one or more commas, then the group separator character is inserted between all groups of the integer part of the number.

      Example:

       Описатель разделителя групп: 2147483647 ("##,#", en-US) -> 2,147,483,647 2147483647 ("##,#", es-ES) -> 2.147.483.647 
    • Number scaling descriptor : if immediately to the left of an explicit or implicit separator of the integer and fractional parts is one or more commas, the formatted number is divided by 1000 for each comma specified. For example, if the string "0 ,," is used to format the number 100 million, the result is "100".

      Example:

       Описатель масштабирования: 2147483647 ("#,#,,", en-US) -> 2,147 2147483647 ("#,#,,", es-ES) -> 2.147 
  • "#" - Deputy number - Replaces the "#" with the corresponding number, if any. Otherwise, there will be no digit in the result string.

  • "0" - The sign is a proxy zero - Replaces zero with the corresponding number, if any. Otherwise, there will be zero in the result string.

  • "." - Delimiter — Determines the location of the delimiter for the integer and fractional parts in the result string.

  • divides the number by 1000 each time it is used - nipanyatna ... - VladD
  • @VladD, yeah, it's clear by example, but how can I write it down in Russian, which I can’t think of :-) it’s really really the already scaled part - Grundy
  • @VladD, no no, look at an example, it displays exactly as n / 1000 - Grundy