CharUnicodeInfo.GetDecimalDigitValue CharUnicodeInfo.GetDecimalDigitValue CharUnicodeInfo.GetDecimalDigitValue CharUnicodeInfo.GetDecimalDigitValue Method

Definition

Ruft den Dezimalziffernwert eines numerischen Unicode-Zeichens ab.Gets the decimal digit value of a numeric Unicode character.

Überlädt

GetDecimalDigitValue(Char) GetDecimalDigitValue(Char) GetDecimalDigitValue(Char) GetDecimalDigitValue(Char)

Ruft den Dezimalziffernwert des angegebenen numerischen Zeichens ab.Gets the decimal digit value of the specified numeric character.

GetDecimalDigitValue(String, Int32) GetDecimalDigitValue(String, Int32) GetDecimalDigitValue(String, Int32) GetDecimalDigitValue(String, Int32)

Ruft den Dezimalziffernwert des numerischen Zeichens am angegebenen Index der angegebenen Zeichenfolge ab.Gets the decimal digit value of the numeric character at the specified index of the specified string.

GetDecimalDigitValue(Char) GetDecimalDigitValue(Char) GetDecimalDigitValue(Char) GetDecimalDigitValue(Char)

Ruft den Dezimalziffernwert des angegebenen numerischen Zeichens ab.Gets the decimal digit value of the specified numeric character.

public:
 static int GetDecimalDigitValue(char ch);
public static int GetDecimalDigitValue (char ch);
static member GetDecimalDigitValue : char -> int
Public Shared Function GetDecimalDigitValue (ch As Char) As Integer

Parameter

ch
Char Char Char Char

Das Unicode-Zeichen, dessen Dezimalziffernwert abgerufen werden soll.The Unicode character for which to get the decimal digit value.

Gibt zurück

Der Dezimalziffernwert des angegebenen numerischen Zeichens.The decimal digit value of the specified numeric character.

- oder --or- -1, wenn das angegebene Zeichen keine Dezimalziffer ist.-1, if the specified character is not a decimal digit.

Beispiele

Das folgende Codebeispiel zeigt die Werte, die von jeder Methode für verschiedene Arten von Zeichen zurückgegeben.The following code example shows the values returned by each method for different types of characters.

using namespace System;
using namespace System::Globalization;
void PrintProperties( Char c );
int main()
{
   Console::WriteLine( "                                        c  Num   Dig   Dec   UnicodeCategory" );
   Console::Write( "U+0061 LATIN SMALL LETTER A            " );
   PrintProperties( L'a' );
   Console::Write( "U+0393 GREEK CAPITAL LETTER GAMMA      " );
   PrintProperties( L'\u0393' );
   Console::Write( "U+0039 DIGIT NINE                      " );
   PrintProperties( L'9' );
   Console::Write( "U+00B2 SUPERSCRIPT TWO                 " );
   PrintProperties( L'\u00B2' );
   Console::Write( "U+00BC VULGAR FRACTION ONE QUARTER     " );
   PrintProperties( L'\u00BC' );
   Console::Write( "U+0BEF TAMIL DIGIT NINE                " );
   PrintProperties( L'\u0BEF' );
   Console::Write( "U+0BF0 TAMIL NUMBER TEN                " );
   PrintProperties( L'\u0BF0' );
   Console::Write( "U+0F33 TIBETAN DIGIT HALF ZERO         " );
   PrintProperties( L'\u0F33' );
   Console::Write( "U+2788 CIRCLED SANS-SERIF DIGIT NINE   " );
   PrintProperties( L'\u2788' );
}

void PrintProperties( Char c )
{
   Console::Write( " {0,-3}", c );
   Console::Write( " {0,-5}", CharUnicodeInfo::GetNumericValue( c ) );
   Console::Write( " {0,-5}", CharUnicodeInfo::GetDigitValue( c ) );
   Console::Write( " {0,-5}", CharUnicodeInfo::GetDecimalDigitValue( c ) );
   Console::WriteLine( "{0}", CharUnicodeInfo::GetUnicodeCategory( c ) );
}

/*
This code produces the following output.  Some characters might not display at the console.

                                        c  Num   Dig   Dec   UnicodeCategory
U+0061 LATIN SMALL LETTER A             a   -1    -1    -1   LowercaseLetter
U+0393 GREEK CAPITAL LETTER GAMMA       \u0393   -1    -1    -1   UppercaseLetter
U+0039 DIGIT NINE                       9   9     9     9    DecimalDigitNumber
U+00B2 SUPERSCRIPT TWO                  \u00B2   2     2     2    OtherNumber
U+00BC VULGAR FRACTION ONE QUARTER      \u00BC   0.25  -1    -1   OtherNumber
U+0BEF TAMIL DIGIT NINE                 \u0BEF   9     9     9    DecimalDigitNumber
U+0BF0 TAMIL NUMBER TEN                 \u0BF0   10    -1    -1   OtherNumber
U+0F33 TIBETAN DIGIT HALF ZERO          \u0F33   -0.5  -1    -1   OtherNumber
U+2788 CIRCLED SANS-SERIF DIGIT NINE    \u2788   9     9     -1   OtherNumber

*/
using System;
using System.Globalization;

public class SamplesCharUnicodeInfo  {

   public static void Main()  {

      Console.WriteLine( "                                        c  Num   Dig   Dec   UnicodeCategory" );

      Console.Write( "U+0061 LATIN SMALL LETTER A            " );
      PrintProperties( 'a' );

      Console.Write( "U+0393 GREEK CAPITAL LETTER GAMMA      " );
      PrintProperties( '\u0393' );

      Console.Write( "U+0039 DIGIT NINE                      " );
      PrintProperties( '9' );

      Console.Write( "U+00B2 SUPERSCRIPT TWO                 " );
      PrintProperties( '\u00B2' );

      Console.Write( "U+00BC VULGAR FRACTION ONE QUARTER     " );
      PrintProperties( '\u00BC' );

      Console.Write( "U+0BEF TAMIL DIGIT NINE                " );
      PrintProperties( '\u0BEF' );

      Console.Write( "U+0BF0 TAMIL NUMBER TEN                " );
      PrintProperties( '\u0BF0' );

      Console.Write( "U+0F33 TIBETAN DIGIT HALF ZERO         " );
      PrintProperties( '\u0F33' );

      Console.Write( "U+2788 CIRCLED SANS-SERIF DIGIT NINE   " );
      PrintProperties( '\u2788' );

   }

   public static void PrintProperties( char c )  {
      Console.Write( " {0,-3}", c );
      Console.Write( " {0,-5}", CharUnicodeInfo.GetNumericValue( c ) );
      Console.Write( " {0,-5}", CharUnicodeInfo.GetDigitValue( c ) );
      Console.Write( " {0,-5}", CharUnicodeInfo.GetDecimalDigitValue( c ) );
      Console.WriteLine( "{0}", CharUnicodeInfo.GetUnicodeCategory( c ) );
   }

}


/*
This code produces the following output.  Some characters might not display at the console.

                                        c  Num   Dig   Dec   UnicodeCategory
U+0061 LATIN SMALL LETTER A             a   -1    -1    -1   LowercaseLetter
U+0393 GREEK CAPITAL LETTER GAMMA       \u0393   -1    -1    -1   UppercaseLetter
U+0039 DIGIT NINE                       9   9     9     9    DecimalDigitNumber
U+00B2 SUPERSCRIPT TWO                  \u00B2   2     2     2    OtherNumber
U+00BC VULGAR FRACTION ONE QUARTER      \u00BC   0.25  -1    -1   OtherNumber
U+0BEF TAMIL DIGIT NINE                 \u0BEF   9     9     9    DecimalDigitNumber
U+0BF0 TAMIL NUMBER TEN                 \u0BF0   10    -1    -1   OtherNumber
U+0F33 TIBETAN DIGIT HALF ZERO          \u0F33   -0.5  -1    -1   OtherNumber
U+2788 CIRCLED SANS-SERIF DIGIT NINE    \u2788   9     9     -1   OtherNumber

*/

Imports System
Imports System.Globalization
Imports Microsoft.VisualBasic

Public Class SamplesCharUnicodeInfo   

   Public Shared Sub Main()

      Console.WriteLine("                                        c  Num   Dig   Dec   UnicodeCategory")

      Console.Write("U+0061 LATIN SMALL LETTER A            ")
      PrintProperties("a"c)

      Console.Write("U+0393 GREEK CAPITAL LETTER GAMMA      ")
      PrintProperties(ChrW(&H0393))

      Console.Write("U+0039 DIGIT NINE                      ")
      PrintProperties("9"c)

      Console.Write("U+00B2 SUPERSCRIPT TWO                 ")
      PrintProperties(ChrW(&H00B2))

      Console.Write("U+00BC VULGAR FRACTION ONE QUARTER     ")
      PrintProperties(ChrW(&H00BC))

      Console.Write("U+0BEF TAMIL DIGIT NINE                ")
      PrintProperties(ChrW(&H0BEF))

      Console.Write("U+0BF0 TAMIL NUMBER TEN                ")
      PrintProperties(ChrW(&H0BF0))

      Console.Write("U+0F33 TIBETAN DIGIT HALF ZERO         ")
      PrintProperties(ChrW(&H0F33))

      Console.Write("U+2788 CIRCLED SANS-SERIF DIGIT NINE   ")
      PrintProperties(ChrW(&H2788))

   End Sub 'Main

   Public Shared Sub PrintProperties(c As Char)
      Console.Write(" {0,-3}", c)
      Console.Write(" {0,-5}", CharUnicodeInfo.GetNumericValue(c))
      Console.Write(" {0,-5}", CharUnicodeInfo.GetDigitValue(c))
      Console.Write(" {0,-5}", CharUnicodeInfo.GetDecimalDigitValue(c))
      Console.WriteLine("{0}", CharUnicodeInfo.GetUnicodeCategory(c))
   End Sub 'PrintProperties

End Class 'SamplesCharUnicodeInfo 


'This code produces the following output.  Some characters might not display at the console.
'
'                                        c  Num   Dig   Dec   UnicodeCategory
'U+0061 LATIN SMALL LETTER A             a   -1    -1    -1   LowercaseLetter
'U+0393 GREEK CAPITAL LETTER GAMMA       \u0393   -1    -1    -1   UppercaseLetter
'U+0039 DIGIT NINE                       9   9     9     9    DecimalDigitNumber
'U+00B2 SUPERSCRIPT TWO                  \u00B2   2     2     2    OtherNumber
'U+00BC VULGAR FRACTION ONE QUARTER      \u00BC   0.25  -1    -1   OtherNumber
'U+0BEF TAMIL DIGIT NINE                 \u0BEF   9     9     9    DecimalDigitNumber
'U+0BF0 TAMIL NUMBER TEN                 \u0BF0   10    -1    -1   OtherNumber
'U+0F33 TIBETAN DIGIT HALF ZERO          \u0F33   -0.5  -1    -1   OtherNumber
'U+2788 CIRCLED SANS-SERIF DIGIT NINE    \u2788   9     9     -1   OtherNumber

Hinweise

Diese Methode konvertiert Zeichen, die Dezimalziffern in die entsprechenden ganzzahligen Werte darstellen.This method converts characters that represent decimal digits to their equivalent integral values. Dezimalstellen werden Zeichen in der DecimalDigitNumber Kategorie aus, die eine der zehn Ziffern im Dezimalwert (Basis 10) Zahlensystem, von 0 bis 9 darstellen kann.Decimal digits are characters in the DecimalDigitNumber category that can represent one of ten digits in the decimal (base 10) numbering system, from zero through nine. Es enthält Zeichen wie z. B. U + 0030 (Ziffer Null) bis U + 0039 (Ziffer 9), U + 0660 (Arabisch-INDISCHE Ziffern null) bis U + 0669 (Arabisch-INDISCHE Ziffern neun), U + 07 C 0 (NKO Ziffer Null) bis U + 07C 9 (NKO Ziffer 9) und U + 1040 (MYANMAR Ziffer Null) bis U + 1049) MYANMAR-ZIFFER 9).It includes characters such as U+0030 (DIGIT ZERO) through U+0039 (DIGIT NINE), U+0660 (ARABIC-INDIC DIGIT ZERO) through U+0669 (ARABIC-INDIC DIGIT NINE), U+07C0 (NKO DIGIT ZERO) through U+07C9 (NKO DIGIT NINE), and U+1040 (MYANMAR DIGIT ZERO) through U+1049 (MYANMAR DIGIT NINE).

Weitere Informationen zu Unicode-Zeichen, finden Sie unter den Unicode-Standard.For more information about Unicode characters, see the Unicode Standard.

GetDecimalDigitValue(String, Int32) GetDecimalDigitValue(String, Int32) GetDecimalDigitValue(String, Int32) GetDecimalDigitValue(String, Int32)

Ruft den Dezimalziffernwert des numerischen Zeichens am angegebenen Index der angegebenen Zeichenfolge ab.Gets the decimal digit value of the numeric character at the specified index of the specified string.

public:
 static int GetDecimalDigitValue(System::String ^ s, int index);
public static int GetDecimalDigitValue (string s, int index);
static member GetDecimalDigitValue : string * int -> int
Public Shared Function GetDecimalDigitValue (s As String, index As Integer) As Integer

Parameter

s
String String String String

Der String mit dem Unicode-Zeichen, dessen Dezimalziffernwert abgerufen werden soll.The String containing the Unicode character for which to get the decimal digit value.

index
Int32 Int32 Int32 Int32

Der Index des Unicode-Zeichens, dessen Dezimalziffernwert abgerufen werden soll.The index of the Unicode character for which to get the decimal digit value.

Gibt zurück

Der Dezimalziffernwert des numerischen Zeichens am angegebenen Index der angegebenen Zeichenfolge.The decimal digit value of the numeric character at the specified index of the specified string.

- oder --or- -1, wenn das Zeichen am angegebenen Index der angegebenen Zeichenfolge keine Dezimalziffer ist.-1, if the character at the specified index of the specified string is not a decimal digit.

Ausnahmen

index liegt außerhalb des Bereichs der gültigen Indizes für s.index is outside the range of valid indexes in s.

Beispiele

Das folgende Codebeispiel zeigt die Werte, die von jeder Methode für verschiedene Arten von Zeichen zurückgegeben.The following code example shows the values returned by each method for different types of characters.

using namespace System;
using namespace System::Globalization;
int main()
{
   
   // The String to get information for.
   String^ s = "a9\u0393\u00B2\u00BC\u0BEF\u0BF0\u2788";
   Console::WriteLine( "String: {0}", s );
   
   // Print the values for each of the characters in the string.
   Console::WriteLine( "index c  Num   Dig   Dec   UnicodeCategory" );
   for ( int i = 0; i < s->Length; i++ )
   {
      Console::Write( "{0,-5} {1,-3}", i, s[ i ] );
      Console::Write( " {0,-5}", CharUnicodeInfo::GetNumericValue( s, i ) );
      Console::Write( " {0,-5}", CharUnicodeInfo::GetDigitValue( s, i ) );
      Console::Write( " {0,-5}", CharUnicodeInfo::GetDecimalDigitValue( s, i ) );
      Console::WriteLine( "{0}", CharUnicodeInfo::GetUnicodeCategory( s, i ) );

   }
}

/*
This code produces the following output.  Some characters might not display at the console.

String: a9\u0393\u00B2\u00BC\u0BEF\u0BF0\u2788
index c  Num   Dig   Dec   UnicodeCategory
0     a   -1    -1    -1   LowercaseLetter
1     9   9     9     9    DecimalDigitNumber
2     \u0393   -1    -1    -1   UppercaseLetter
3     \u00B2   2     2     2    OtherNumber
4     \u00BC   0.25  -1    -1   OtherNumber
5     \u0BEF   9     9     9    DecimalDigitNumber
6     \u0BF0   10    -1    -1   OtherNumber
7     \u2788   9     9     -1   OtherNumber

*/
using System;
using System.Globalization;

public class SamplesCharUnicodeInfo  {

   public static void Main()  {

      // The String to get information for.
      String s = "a9\u0393\u00B2\u00BC\u0BEF\u0BF0\u2788";
      Console.WriteLine( "String: {0}", s );

      // Print the values for each of the characters in the string.
      Console.WriteLine( "index c  Num   Dig   Dec   UnicodeCategory" );
      for ( int i = 0; i < s.Length; i++ )  {
         Console.Write( "{0,-5} {1,-3}", i, s[i] );
         Console.Write( " {0,-5}", CharUnicodeInfo.GetNumericValue( s, i ) );
         Console.Write( " {0,-5}", CharUnicodeInfo.GetDigitValue( s, i ) );
         Console.Write( " {0,-5}", CharUnicodeInfo.GetDecimalDigitValue( s, i ) );
         Console.WriteLine( "{0}", CharUnicodeInfo.GetUnicodeCategory( s, i ) );
      }

   }

}


/*
This code produces the following output.  Some characters might not display at the console.

String: a9\u0393\u00B2\u00BC\u0BEF\u0BF0\u2788
index c  Num   Dig   Dec   UnicodeCategory
0     a   -1    -1    -1   LowercaseLetter
1     9   9     9     9    DecimalDigitNumber
2     \u0393   -1    -1    -1   UppercaseLetter
3     \u00B2   2     2     2    OtherNumber
4     \u00BC   0.25  -1    -1   OtherNumber
5     \u0BEF   9     9     9    DecimalDigitNumber
6     \u0BF0   10    -1    -1   OtherNumber
7     \u2788   9     9     -1   OtherNumber

*/

Imports System
Imports System.Globalization

Public Class SamplesCharUnicodeInfo   

   Public Shared Sub Main()

      ' The String to get information for.
      Dim s As [String] = "a9\u0393\u00B2\u00BC\u0BEF\u0BF0\u2788"
      Console.WriteLine("String: {0}", s)

      ' Print the values for each of the characters in the string.
      Console.WriteLine("index c  Num   Dig   Dec   UnicodeCategory")
      Dim i As Integer
      For i = 0 To s.Length - 1
         Console.Write("{0,-5} {1,-3}", i, s(i))
         Console.Write(" {0,-5}", CharUnicodeInfo.GetNumericValue(s, i))
         Console.Write(" {0,-5}", CharUnicodeInfo.GetDigitValue(s, i))
         Console.Write(" {0,-5}", CharUnicodeInfo.GetDecimalDigitValue(s, i))
         Console.WriteLine("{0}", CharUnicodeInfo.GetUnicodeCategory(s, i))
      Next i

   End Sub 'Main 

End Class 'SamplesCharUnicodeInfo


'This code produces the following output.  Some characters might not display at the console.
'
'String: a9\u0393\u00B2\u00BC\u0BEF\u0BF0\u2788
'index c  Num   Dig   Dec   UnicodeCategory
'0     a   -1    -1    -1   LowercaseLetter
'1     9   9     9     9    DecimalDigitNumber
'2     \u0393   -1    -1    -1   UppercaseLetter
'3     \u00B2   2     2     2    OtherNumber
'4     \u00BC   0.25  -1    -1   OtherNumber
'5     \u0BEF   9     9     9    DecimalDigitNumber
'6     \u0BF0   10    -1    -1   OtherNumber
'7     \u2788   9     9     -1   OtherNumber

Hinweise

Diese Methode konvertiert Zeichen, die Dezimalziffern in die entsprechenden ganzzahligen Werte darstellen.This method converts characters that represent decimal digits to their equivalent integral values. Dezimalstellen werden Zeichen in der DecimalDigitNumber Kategorie aus, die eine der zehn Ziffern im Dezimalwert (Basis 10) Zahlensystem, von 0 bis 9 darstellen kann.Decimal digits are characters in the DecimalDigitNumber category that can represent one of ten digits in the decimal (base 10) numbering system, from zero through nine. Es enthält Zeichen wie z. B. U + 0030 (Ziffer Null) bis U + 0039 (Ziffer 9), U + 0660 (Arabisch-INDISCHE Ziffern null) bis U + 0669 (Arabisch-INDISCHE Ziffern neun), U + 07 C 0 (NKO Ziffer Null) bis U + 07C 9 (NKO Ziffer 9) und U + 1040 (MYANMAR Ziffer Null) bis U + 1049) MYANMAR-ZIFFER 9).It includes characters such as U+0030 (DIGIT ZERO) through U+0039 (DIGIT NINE), U+0660 (ARABIC-INDIC DIGIT ZERO) through U+0669 (ARABIC-INDIC DIGIT NINE), U+07C0 (NKO DIGIT ZERO) through U+07C9 (NKO DIGIT NINE), and U+1040 (MYANMAR DIGIT ZERO) through U+1049 (MYANMAR DIGIT NINE).

Weitere Informationen zu Unicode-Zeichen, finden Sie unter den Unicode-Standard.For more information about Unicode characters, see the Unicode Standard.

Gilt für: