Skip to content

Commit

Permalink
CurrencyNegativePattern can be 16 (#9081)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexRadch committed Jun 16, 2023
1 parent a14317d commit d617861
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static void Main()
string[] patternStrings= { "($n)", "-$n", "$-n", "$n-", "(n$)",
"-n$", "n-$", "n$-", "-n $", "-$ n",
"n $-", "$ n-", "$ -n", "n- $", "($ n)",
"(n $)" };
"(n $)", "$- n" };
for (int ctr = patternStrings.GetLowerBound(0);
ctr <= patternStrings.GetUpperBound(0); ctr++)
patterns.Add(ctr, patternStrings[ctr]);
Expand Down Expand Up @@ -48,4 +48,9 @@ public int Compare(CultureInfo x, CultureInfo y)
// de-LI: 2 ( $-n) CHF-16.34
// de-LU: 8 ( -n $) -16,34 €
// dsb-DE: 8 ( -n $) -16,34 €
// luy-KE: 16 ( $- n) Ksh- 16.34
//
// The result shown here happens only if using ICU.
// Apps that use NLS, for example, .NET Framework apps, might see different results.
// Globalization data can change, which would also change these results.
// </Snippet1>
Original file line number Diff line number Diff line change
Expand Up @@ -2979,7 +2979,7 @@ Number.prototype._toFormattedString = function Number$_toFormattedString(format,
var _percentNegativePattern = ["-n %", "-n%", "-%n"];
var _numberNegativePattern = ["(n)","-n","- n","n-","n -"];
var _currencyPositivePattern = ["$n","n$","$ n","n $"];
var _currencyNegativePattern = ["($n)","-$n","$-n","$n-","(n$)","-n$","n-$","n$-","-n $","-$ n","n $-","$ n-","$ -n","n- $","($ n)","(n $)"];
var _currencyNegativePattern = ["($n)","-$n","$-n","$n-","(n$)","-n$","n-$","n$-","-n $","-$ n","n $-","$ n-","$ -n","n- $","($ n)","(n $)","$- n"];
function zeroPad(str, count, left) {
for (var l=str.length; l < count; l++) {
str = (left ? ('0' + str) : (str + '0'));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net7.0</TargetFrameworks>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Public Class Example : Implements IComparer(Of CultureInfo)
Dim patternStrings() As String = { "($n)", "-$n", "$-n", "$n-", "(n$)",
"-n$", "n-$", "n$-", "-n $", "-$ n",
"n $-", "$ n-", "$ -n", "n- $", "($ n)",
"(n $)" }
"(n $)", "$- n" }
For ctr As Integer = patternStrings.GetLowerBound(0) To patternStrings.GetUpperBound(0)
patterns.Add(ctr, patternStrings(ctr))
Next
Expand Down Expand Up @@ -49,4 +49,9 @@ End Class
' de-LI: 2 ( $-n) CHF-16.34
' de-LU: 8 ( -n $) -16,34 €
' dsb-DE: 8 ( -n $) -16,34 €
' luy-KE: 16 ( $- n) Ksh- 16.34
'
' The result shown here happens only if using ICU.
' Apps that use NLS, for example, .NET Framework apps, might see different results.
' Globalization data can change, which would also change these results.
' </Snippet1>
3 changes: 2 additions & 1 deletion xml/System.Globalization/NumberFormatInfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,7 @@
|13|n- $|
|14|($ n)|
|15|(n $)|
|16|$- n|
Expand All @@ -862,7 +863,7 @@
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The property is being set to a value that is less than 0 or greater than 15.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">The property is set to a value that's less than 0 or greater than 16. On .NET Core 3.1 and earlier versions, this exception is thrown if the value is greater than 15.</exception>
<exception cref="T:System.InvalidOperationException">The property is being set and the <see cref="T:System.Globalization.NumberFormatInfo" /> object is read-only.</exception>
<altmember cref="P:System.Globalization.NumberFormatInfo.CurrencyDecimalDigits" />
<altmember cref="P:System.Globalization.NumberFormatInfo.CurrencyDecimalSeparator" />
Expand Down

0 comments on commit d617861

Please sign in to comment.