Strings.FormatPercent(Object, Int32, TriState, TriState, TriState) Yöntem
Tanım
% Karakteriyle bir yüzde (yani, 100 ile çarpılmış) olarak biçimlendirilen bir ifade döndürür.Returns an expression formatted as a percentage (that is, multiplied by 100) with a trailing % character.
public static string FormatPercent (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 FormatPercent (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 FormatPercent : obj * int * Microsoft.VisualBasic.TriState * Microsoft.VisualBasic.TriState * Microsoft.VisualBasic.TriState -> string
Public Function FormatPercent (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ğerin sağ tarafına kaç tane görüntüleneceğini gösteren sayısal değer.Numeric value indicating how many places to the right of the decimal are displayed. Varsayılan değer-1 ' dir ve yerel ayar ayarlarının kullanıldığını gösterir.Default value is -1, which indicates that the locale settings are used.
- IncludeLeadingDigit
- TriState
İsteğe bağlı.Optional. TriState kesirli değerler için önünde sıfır görüntülenip görüntülenmeyeceğini belirten sabit.TriState constant that indicates whether or not a leading zero displays 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 or not 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
Bir yüzde olarak biçimlendirilen (yani, 100 ile çarpılmış) bir ifade, sonunda% karakteriyle.An expression formatted as a percentage (that is, multiplied by 100) with a trailing % character.
Özel durumlar
Tür sayısal değil.Type is not numeric.
Örnekler
Bu örnek, işlevinin kullanımını gösterir FormatPercent .This example illustrates the use of the FormatPercent function.
Dim testNumber As Single = 0.76
' Returns "76.00%".
Dim testString As String = FormatPercent(testNumber)
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 ayar 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.Default |
Bilgisayarın bölgesel ayarlarıThe computer's regional settings |