diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2004-06-14 12:54:31 +0400 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2004-06-14 12:54:31 +0400 |
commit | 620e3d84e2caee43f4f3f401e9862a760fc3dc20 (patch) | |
tree | c1b657aa99f14c76c16fdbc1c4444dc4ac8c153f /mcs/class/corlib/System/FloatingPointFormatter.cs | |
parent | f5d2c69c7ac3c9beb6e0b4c50225ba131e4e4c83 (diff) |
2004-06-14 Atsushi Enomoto <atsushi@ximian.com>
* Double.cs : Use IFormatProvider.GetFormat() instead of literal '-'.
* FloatingPointFormatter.cs :
Use NumberFormatInfo.NegativeSign. This change saves many XSLT test
failures.
Format Permille pattern (It is undocumented but actually available,
and used in xsl:format-number).
svn path=/trunk/mcs/; revision=29483
Diffstat (limited to 'mcs/class/corlib/System/FloatingPointFormatter.cs')
-rw-r--r-- | mcs/class/corlib/System/FloatingPointFormatter.cs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/mcs/class/corlib/System/FloatingPointFormatter.cs b/mcs/class/corlib/System/FloatingPointFormatter.cs index a436b03a965..f9d2011bc82 100644 --- a/mcs/class/corlib/System/FloatingPointFormatter.cs +++ b/mcs/class/corlib/System/FloatingPointFormatter.cs @@ -592,7 +592,7 @@ namespace System { return "0"; } if (result.Length > 0) { - result = "-" + result; + result = nfi.NegativeSign + result; } return result; } @@ -628,6 +628,7 @@ namespace System { public int NumberOfColons; public bool Groupping; public bool Percent; + public bool Permille; public int DotPos; public int ExpPos; public int FirstFormatPos; @@ -676,6 +677,9 @@ namespace System { case '%': f.Percent = true; break; + case '\u2030': + f.Permille = true; + break; case 'e': case 'E': f.DecimalLength = count; @@ -705,13 +709,17 @@ namespace System { if (f.FirstFormatPos < 0) { return format; } - if (((f.Percent) || (f.NumberOfColons > 0)) && (f.ExpPos < 0)) { + if (((f.Percent) || (f.Permille) || (f.NumberOfColons > 0)) && (f.ExpPos < 0)) { int len = f.DecimalLength; int exp = 0; if (f.Percent) { len += 2; exp += 2; } + else if (f.Permille) { + len += 3; + exp += 3; + } if (f.NumberOfColons > 0) { len -= (3 * f.NumberOfColons); exp -= 3 * f.NumberOfColons; |