Skip to content

Commit

Permalink
2004-06-14 Atsushi Enomoto <atsushi@ximian.com>
Browse files Browse the repository at this point in the history
	* FloatingPointFormatter.cs : Recognize '%' and '\u2030' and replace
	  them with matching NumberFormatInfo properties.

svn path=/trunk/mcs/; revision=29487
  • Loading branch information
atsushieno committed Jun 14, 2004
1 parent 39782ca commit acb6944
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions mcs/class/corlib/System/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2004-06-14 Atsushi Enomoto <atsushi@ximian.com>

* FloatingPointFormatter.cs : Recognize '%' and '\u2030' and replace
them with matching NumberFormatInfo properties.

2004-06-14 Atsushi Enomoto <atsushi@ximian.com>

* Double.cs : Use IFormatProvider.GetFormat() instead of literal '-'.
Expand Down
14 changes: 13 additions & 1 deletion mcs/class/corlib/System/FloatingPointFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,10 @@ private string FormatCustomParser (Format formatData, double value,
else if (format[i] == '\\') {
sb.Append(format[++i]);
}
else if (format [i] == '%')
sb.Append (nfi.PercentSymbol);
else if (format [i] == '\u2030')
sb.Append (nfi.PerMilleSymbol);
else {
sb.Append(format[i]);
}
Expand Down Expand Up @@ -904,6 +908,10 @@ private string FormatCustomParser (Format formatData, double value,
}
}
}
else if (format [i] == '%')
sb.Insert (0, nfi.PercentSymbol);
else if (format [i] == '\u2030')
sb.Insert (0, nfi.PerMilleSymbol);
else if (format[i] != ',') {
sb.Insert(0, format[i]);
}
Expand Down Expand Up @@ -931,7 +939,11 @@ private string FormatCustomParser (Format formatData, double value,
mantissa /= 10;
}
for (int i = f.FirstFormatPos - 1; i >= 0; i--) {
if (format [i] != '.')
if (format [i] == '%')
sb.Insert (0, nfi.PercentSymbol);
else if (format [i] == '\u2030')
sb.Insert (0, nfi.PerMilleSymbol);
else if (format [i] != '.')
sb.Insert(0, format[i]);
}
return sb.ToString();
Expand Down

0 comments on commit acb6944

Please sign in to comment.