Strings.FormatNumber(Object, Int32, TriState, TriState, TriState) Yöntem
Tanım
Sayı olarak biçimlendirilen bir ifade döndürür.Returns an expression formatted as a number.
public static string FormatNumber (object? Expression, int NumDigitsAfterDecimal = -1, Microsoft.VisualBasic.TriState IncludeLeadingDigit = Microsoft.VisualBasic.TriState.UseDefault, Microsoft.VisualBasic.TriState UseParensForNegativeNumbers = Microsoft.VisualBasic.TriState.UseDefault, Microsoft.VisualBasic.TriState GroupDigits = Microsoft.VisualBasic.TriState.UseDefault);
public static string FormatNumber (object Expression, int NumDigitsAfterDecimal = -1, Microsoft.VisualBasic.TriState IncludeLeadingDigit = Microsoft.VisualBasic.TriState.UseDefault, Microsoft.VisualBasic.TriState UseParensForNegativeNumbers = Microsoft.VisualBasic.TriState.UseDefault, Microsoft.VisualBasic.TriState GroupDigits = Microsoft.VisualBasic.TriState.UseDefault);
static member FormatNumber : obj * int * Microsoft.VisualBasic.TriState * Microsoft.VisualBasic.TriState * Microsoft.VisualBasic.TriState -> string
Public Function FormatNumber (Expression As Object, Optional NumDigitsAfterDecimal As Integer = -1, Optional IncludeLeadingDigit As TriState = Microsoft.VisualBasic.TriState.UseDefault, Optional UseParensForNegativeNumbers As TriState = Microsoft.VisualBasic.TriState.UseDefault, Optional GroupDigits As TriState = Microsoft.VisualBasic.TriState.UseDefault) As String
Parametreler
- Expression
- Object
Gereklidir.Required. Biçimlendirilecek ifade.Expression to be formatted.
- NumDigitsAfterDecimal
- Int32
İsteğe bağlı.Optional. Ondalık değeri, Decimal 'ın sağında kaç basamak gösterileceğini belirtir.Numeric value indicating how many places are displayed to the right of the decimal. Varsayılan değer-1 ' dir, bu da bilgisayarın bölgesel ayarlarının kullanıldığını gösterir.The default value is -1, which indicates that the computer's regional settings are used.
- IncludeLeadingDigit
- TriState
İsteğe bağlı.Optional. TriState kesirli değerler için öndeki 0 gösterilip gösterilmeyeceğini belirten sabit.TriState constant that indicates whether a leading 0 is displayed for fractional values. Değerler için "Ayarlar"a bakın.See "Settings" for values.
- UseParensForNegativeNumbers
- TriState
İsteğe bağlı.Optional. TriState negatif değerlerin parantez içine yerleştirip yerleştirmeyeceğini belirten sabit.TriState constant that indicates whether to place negative values within parentheses. Değerler için "Ayarlar"a bakın.See "Settings" for values.
- GroupDigits
- TriState
İsteğe bağlı.Optional. TriState sayıların yerel ayarlarda belirtilen grup sınırlayıcısı kullanılarak gruplandırılıp gruplanmadığını belirten sabit.TriState constant that indicates whether or not numbers are grouped using the group delimiter specified in the locale settings. Değerler için "Ayarlar"a bakın.See "Settings" for values.
Döndürülenler
Sayı olarak biçimlendirilen bir ifade.An expression formatted as a number.
Özel durumlar
Tür sayısal değil.Type is not numeric.
Örnekler
Bu örnek, FormatNumber işlevini gösterir.This example demonstrates the FormatNumber function.
Dim testNumber As Integer = 45600
' Returns "45,600.00".
Dim testString As String = FormatNumber(testNumber, 2, , , TriState.True)
Açıklamalar
Bir veya daha fazla isteğe bağlı bağımsız değişken atlandığında, atlanan bağımsız değişkenlerin değerleri yerel ayarlar tarafından sağlanır.When one or more optional arguments are omitted the values for omitted arguments are provided by the locale settings.
Not
Tüm ayar bilgileri, uygulamanın yerel ayarından gelir.All settings information comes from the locale of the application. Varsayılan olarak, Denetim Masası 'nda yerel ayar olarak ayarlanır.By default, that will be the locale set in the control panel. Ancak, .NET Framework kullanılarak programlı bir şekilde değiştirilebilir.However, it may be changed programmatically by using the .NET Framework.
IncludeLeadingDigit, UseParensForNegativeNumbers Ve GroupDigits bağımsız değişkenleri aşağıdaki ayarlara sahiptir.The IncludeLeadingDigit, UseParensForNegativeNumbers, and GroupDigits arguments have the following settings.
| SabitConstant | DescriptionDescription |
|---|---|
TriState.True |
DoğruTrue |
TriState.False |
YanlışFalse |
TriState.UseDefault |
Bilgisayarın bölgesel ayarlarıThe computer's regional settings |