Skip to content

Commit d617861

Browse files
authored
CurrencyNegativePattern can be 16 (dotnet#9081)
1 parent a14317d commit d617861

File tree

5 files changed

+23
-4
lines changed

5 files changed

+23
-4
lines changed

snippets/csharp/System.Globalization/NumberFormatInfo/CurrencyNegativePattern/currencynegativepattern1.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public static void Main()
1313
string[] patternStrings= { "($n)", "-$n", "$-n", "$n-", "(n$)",
1414
"-n$", "n-$", "n$-", "-n $", "-$ n",
1515
"n $-", "$ n-", "$ -n", "n- $", "($ n)",
16-
"(n $)" };
16+
"(n $)", "$- n" };
1717
for (int ctr = patternStrings.GetLowerBound(0);
1818
ctr <= patternStrings.GetUpperBound(0); ctr++)
1919
patterns.Add(ctr, patternStrings[ctr]);
@@ -48,4 +48,9 @@ public int Compare(CultureInfo x, CultureInfo y)
4848
// de-LI: 2 ( $-n) CHF-16.34
4949
// de-LU: 8 ( -n $) -16,34 €
5050
// dsb-DE: 8 ( -n $) -16,34 €
51+
// luy-KE: 16 ( $- n) Ksh- 16.34
52+
//
53+
// The result shown here happens only if using ICU.
54+
// Apps that use NLS, for example, .NET Framework apps, might see different results.
55+
// Globalization data can change, which would also change these results.
5156
// </Snippet1>

snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/microsoftajax.debug.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2979,7 +2979,7 @@ Number.prototype._toFormattedString = function Number$_toFormattedString(format,
29792979
var _percentNegativePattern = ["-n %", "-n%", "-%n"];
29802980
var _numberNegativePattern = ["(n)","-n","- n","n-","n -"];
29812981
var _currencyPositivePattern = ["$n","n$","$ n","n $"];
2982-
var _currencyNegativePattern = ["($n)","-$n","$-n","$n-","(n$)","-n$","n-$","n$-","-n $","-$ n","n $-","$ n-","$ -n","n- $","($ n)","(n $)"];
2982+
var _currencyNegativePattern = ["($n)","-$n","$-n","$n-","(n$)","-n$","n-$","n$-","-n $","-$ n","n $-","$ n-","$ -n","n- $","($ n)","(n $)","$- n"];
29832983
function zeroPad(str, count, left) {
29842984
for (var l=str.length; l < count; l++) {
29852985
str = (left ? ('0' + str) : (str + '0'));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFrameworks>net7.0</TargetFrameworks>
6+
</PropertyGroup>
7+
8+
</Project>

snippets/visualbasic/VS_Snippets_CLR_System/system.globalization.numberformatinfo.currencynegativepattern/vb/currencynegativepattern1.vb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Public Class Example : Implements IComparer(Of CultureInfo)
1313
Dim patternStrings() As String = { "($n)", "-$n", "$-n", "$n-", "(n$)",
1414
"-n$", "n-$", "n$-", "-n $", "-$ n",
1515
"n $-", "$ n-", "$ -n", "n- $", "($ n)",
16-
"(n $)" }
16+
"(n $)", "$- n" }
1717
For ctr As Integer = patternStrings.GetLowerBound(0) To patternStrings.GetUpperBound(0)
1818
patterns.Add(ctr, patternStrings(ctr))
1919
Next
@@ -49,4 +49,9 @@ End Class
4949
' de-LI: 2 ( $-n) CHF-16.34
5050
' de-LU: 8 ( -n $) -16,34 €
5151
' dsb-DE: 8 ( -n $) -16,34 €
52+
' luy-KE: 16 ( $- n) Ksh- 16.34
53+
'
54+
' The result shown here happens only if using ICU.
55+
' Apps that use NLS, for example, .NET Framework apps, might see different results.
56+
' Globalization data can change, which would also change these results.
5257
' </Snippet1>

xml/System.Globalization/NumberFormatInfo.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,7 @@
851851
|13|n- $|
852852
|14|($ n)|
853853
|15|(n $)|
854+
|16|$- n|
854855
855856
856857
@@ -862,7 +863,7 @@
862863
863864
]]></format>
864865
</remarks>
865-
<exception cref="T:System.ArgumentOutOfRangeException">The property is being set to a value that is less than 0 or greater than 15.</exception>
866+
<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>
866867
<exception cref="T:System.InvalidOperationException">The property is being set and the <see cref="T:System.Globalization.NumberFormatInfo" /> object is read-only.</exception>
867868
<altmember cref="P:System.Globalization.NumberFormatInfo.CurrencyDecimalDigits" />
868869
<altmember cref="P:System.Globalization.NumberFormatInfo.CurrencyDecimalSeparator" />

0 commit comments

Comments
 (0)