VB.Net Tutorial/Data Type/Numeric format — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 15:54, 26 мая 2010
Numeric format: {0:N}, {1:E} and G5
<source lang="vbnet">Public Class Tester
Public Shared Sub Main Dim intValue As Integer = 1234567 Dim floatValue As Double = Math.PI Dim result As New System.Text.StringBuilder result.AppendLine(String.Format("{0} ... {1}", _ intValue, floatValue)) result.AppendLine(String.Format("{0:N} ... {1:E}", _ intValue, floatValue)) result.AppendLine(intValue.ToString("N5") & " ... " & _ floatValue.ToString("G5")) Console.WriteLine(result.ToString()) End Sub
End Class</source>
1234567 ... 3.14159265358979 1,234,567.00 ... 3.141593E+000 1,234,567.00000 ... 3.1416