Char.IsDigit Método
Definição
Indica se um caractere Unicode é categorizado como um dígito decimal.Indicates whether a Unicode character is categorized as a decimal digit.
Sobrecargas
| IsDigit(Char) |
Indica se o caractere Unicode especificado é categorizado como um dígito decimal.Indicates whether the specified Unicode character is categorized as a decimal digit. |
| IsDigit(String, Int32) |
Indica se o caractere na posição especificada em uma cadeia de caracteres especificada é categorizado como um dígito decimal.Indicates whether the character at the specified position in a specified string is categorized as a decimal digit. |
Exemplos
O exemplo de código a seguir demonstra IsDigit .The following code example demonstrates IsDigit.
using namespace System;
int main()
{
char ch = '8';
Console::WriteLine( Char::IsDigit( ch ) ); // Output: "True"
Console::WriteLine( Char::IsDigit( "sample string", 7 ) ); // Output: "False"
}
using System;
public class IsDigitSample {
public static void Main() {
char ch = '8';
Console.WriteLine(Char.IsDigit(ch)); // Output: "True"
Console.WriteLine(Char.IsDigit("sample string", 7)); // Output: "False"
}
}
Module IsDigitSample
Sub Main()
Dim ch8 As Char
ch8 = "8"c
Console.WriteLine(Char.IsDigit(ch8)) ' Output: "True"
Console.WriteLine(Char.IsDigit("sample string", 6)) ' Output: "False"
End Sub
End Module
Comentários
Os dígitos válidos são membros da UnicodeCategory.DecimalDigitNumber categoria.Valid digits are members of the UnicodeCategory.DecimalDigitNumber category.
IsDigit(Char)
Indica se o caractere Unicode especificado é categorizado como um dígito decimal.Indicates whether the specified Unicode character is categorized as a decimal digit.
public:
static bool IsDigit(char c);
public static bool IsDigit (char c);
static member IsDigit : char -> bool
Public Shared Function IsDigit (c As Char) As Boolean
Parâmetros
- c
- Char
O caractere Unicode a ser avaliado.The Unicode character to evaluate.
Retornos
true se c for um dígito decimal; caso contrário, false.true if c is a decimal digit; otherwise, false.
Comentários
Esse método determina se um Char é um dígito de base 10.This method determines whether a Char is a radix-10 digit. Isso contrasta com IsNumber , que determina se um Char é de qualquer categoria Unicode numérica.This contrasts with IsNumber, which determines whether a Char is of any numeric Unicode category. Os números incluem caracteres como frações, subscritos, sobrescritos, numerais romanos, numeradores de moedas, números encírculos e dígitos específicos de script.Numbers include characters such as fractions, subscripts, superscripts, Roman numerals, currency numerators, encircled numbers, and script-specific digits.
Os dígitos válidos são membros da UnicodeCategory.DecimalDigitNumber categoria.Valid digits are members of the UnicodeCategory.DecimalDigitNumber category.
Confira também
Aplica-se a
IsDigit(String, Int32)
Indica se o caractere na posição especificada em uma cadeia de caracteres especificada é categorizado como um dígito decimal.Indicates whether the character at the specified position in a specified string is categorized as a decimal digit.
public:
static bool IsDigit(System::String ^ s, int index);
public static bool IsDigit (string s, int index);
static member IsDigit : string * int -> bool
Public Shared Function IsDigit (s As String, index As Integer) As Boolean
Parâmetros
- s
- String
Uma cadeia de caracteres.A string.
- index
- Int32
A posição do caractere a ser avaliada em s.The position of the character to evaluate in s.
Retornos
true se o caractere na posição index em s for um dígito decimal; caso contrário, false.true if the character at position index in s is a decimal digit; otherwise, false.
Exceções
s é null.s is null.
index é menor que zero ou maior que a última posição em s.index is less than zero or greater than the last position in s.
Comentários
Esse método determina se um Char é um dígito de base 10.This method determines whether a Char is a radix-10 digit. Isso contrasta com IsNumber , que determina se um Char é de qualquer categoria Unicode numérica.This contrasts with IsNumber, which determines whether a Char is of any numeric Unicode category. Os números incluem caracteres como frações, subscritos, sobrescritos, numerais romanos, numeradores de moedas, números encírculos e dígitos específicos de script.Numbers include characters such as fractions, subscripts, superscripts, Roman numerals, currency numerators, encircled numbers, and script-specific digits.
As posições de caractere em uma cadeia de caracteres são indexadas a partir de zero.Character positions in a string are indexed starting from zero.
Os dígitos válidos são membros da UnicodeCategory.DecimalDigitNumber categoria.Valid digits are members of the UnicodeCategory.DecimalDigitNumber category.