Char.IsLetterOrDigit Method (String, Int32)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Indicates whether the character at the specified position in a specified string is categorized as a letter or a decimal digit.
Assembly: mscorlib (in mscorlib.dll)
'Declaration Public Shared Function IsLetterOrDigit ( _ s As String, _ index As Integer _ ) As Boolean
Parameters
- s
- Type: System.String
A string.
- index
- Type: System.Int32
The position of the character to evaluate in s.
Return Value
Type: System.Booleantrue if the character at position index in s is a letter or a decimal digit; otherwise, false.
| Exception | Condition |
|---|---|
| ArgumentNullException | s is Nothing. |
| ArgumentOutOfRangeException | index is less than zero or greater than the last position in s. |
Character positions in a string are indexed starting from zero.
Valid alphabetic letters and decimal digits are members of the following categories in UnicodeCategory: UppercaseLetter, LowercaseLetter, TitlecaseLetter, ModifierLetter, OtherLetter, or DecimalDigitNumber.
The following example demonstrates IsLetterOrDigit.
Module Example Public Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock) Dim str As String str = "newline:" + vbNewLine outputBlock.Text &= Char.IsLetterOrDigit("8"c) & vbCrLf ' Output: "True" outputBlock.Text += String.Format(Char.IsLetterOrDigit(str, 8)) & vbCrLf ' Output: "False", because it's a NewLine End Sub End Module