Skip to content

Commit 6c7e964

Browse files
glihmglihm
andauthored
Fix Decimal.Parse typos (#4419) (#4559)
Co-authored-by: glihm <[email protected]>
1 parent 733d339 commit 6c7e964

File tree

2 files changed

+10
-10
lines changed
  • samples/snippets
    • csharp/VS_Snippets_CLR_System/system.Decimal.Parse/CS
    • visualbasic/VS_Snippets_CLR_System/system.Decimal.Parse/VB

2 files changed

+10
-10
lines changed

samples/snippets/csharp/VS_Snippets_CLR_System/system.Decimal.Parse/CS/parse.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ private static void CallParse()
2222
number = Decimal.Parse(value);
2323
Console.WriteLine("'{0}' converted to {1}.", value, number);
2424
// Displays:
25-
// 16,523,421' converted to 16523421.
25+
// '16,523,421' converted to 16523421.
2626

2727
// Parse a floating point value with thousands separators
2828
value = "25,162.1378";
2929
number = Decimal.Parse(value);
3030
Console.WriteLine("'{0}' converted to {1}.", value, number);
3131
// Displays:
32-
// 25,162.1378' converted to 25162.1378.
32+
// '25,162.1378' converted to 25162.1378.
3333

3434
// Parse a floating point number with US currency symbol.
3535
value = "$16,321,421.75";
@@ -117,16 +117,16 @@ private static void CallParseWithStylesAndProvider()
117117
NumberStyles style;
118118
CultureInfo provider;
119119

120-
// Parse string using "." as the thousands separator
121-
// and " " as the decimal separator.
120+
// Parse string using " " as the thousands separator
121+
// and "." as the decimal separator.
122122
value = "892 694,12";
123123
style = NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands;
124124
provider = new CultureInfo("fr-FR");
125125

126126
number = Decimal.Parse(value, style, provider);
127127
Console.WriteLine("'{0}' converted to {1}.", value, number);
128128
// Displays:
129-
// 892 694,12' converted to 892694.12.
129+
// '892 694,12' converted to 892694.12.
130130

131131
try
132132
{

samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Parse/VB/parse.vb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ Module modMain
2222
number = Decimal.Parse(value)
2323
Console.WriteLine("'{0}' converted to {1}.", value, number)
2424
' Displays:
25-
' 16,523,421' converted to 16523421.
25+
' '16,523,421' converted to 16523421.
2626

2727
' Parse a floating point value with thousands separators
2828
value = "25,162.1378"
2929
number = Decimal.Parse(value)
3030
Console.WriteLine("'{0}' converted to {1}.", value, number)
3131
' Displays:
32-
' 25,162.1378' converted to 25162.1378.
32+
' '25,162.1378' converted to 25162.1378.
3333

3434
' Parse a floating point number with US currency symbol.
3535
value = "$16,321,421.75"
@@ -106,16 +106,16 @@ Module modMain
106106
Dim style As NumberStyles
107107
Dim provider As CultureInfo
108108

109-
' Parse string using "." as the thousands separator
110-
' and " " as the decimal separator.
109+
' Parse string using " " as the thousands separator
110+
' and "." as the decimal separator.
111111
value = "892 694,12"
112112
style = NumberStyles.AllowDecimalPoint Or NumberStyles.AllowThousands
113113
provider = New CultureInfo("fr-FR")
114114

115115
number = Decimal.Parse(value, style, provider)
116116
Console.WriteLine("'{0}' converted to {1}.", value, number)
117117
' Displays:
118-
' 892 694,12' converted to 892694.12.
118+
' '892 694,12' converted to 892694.12.
119119

120120
Try
121121
number = Decimal.Parse(value, style, CultureInfo.InvariantCulture)

0 commit comments

Comments
 (0)