Bonjour,
Suivant la documentation MSDN.
Lorsque le format contient un dièse (#) à une position, il doit y avoir soit le digit existant à cette position, soit rien du tout (dans le cas où le digit est zéro ou qu'il n'y a rien à cette position).
Pourtant avec le format "### ### ##0.00" et la valeur 12345, j'obtiens " 12345,00" et non pas "12345,00" comme je m'y attendais
J'ai essayé les manière suivantes :
number.ToString(format, CultureInfo.CreateSpecificCulture("fr-FR")) => " 12345,00"
number.ToString(format, CultureInfo.CurrentCulture) => " 12345,00"
number.ToString(format, CultureInfo.InvariantCulture) => " 12345.00"
number.ToString(format, NumberFormatInfo.InvariantInfo) => " 12345.00"
number.ToString(format) => " 12345,00"
Est-ce que j'ai mal compris la documentation ?
Est-ce un bug du Framework (je suis en 4.5.2) ?
Je peux bien évidemment faire un Trim() sur le résultat (c'est d'ailleurs ce que j'ai fait pour palier rapidement au problème).
Cependant j'aimerais comprendre pourquoi j'ai ce résultat (pour ma culture personnelle).
Partager