C# Char IsLetterOrDigit(String, Int32)

Description

Char IsLetterOrDigit(String, Int32) indicates whether the character at the specified position in a specified string is categorized as a letter or a decimal digit.

Syntax

Char.IsLetterOrDigit(String, Int32) has the following syntax.


public static bool IsLetterOrDigit(
  string s,
  int index
)

Parameters

Char.IsLetterOrDigit(String, Int32) has the following parameters.

  • s - A string.
  • index - The position of the character to evaluate in s.

Returns

Char.IsLetterOrDigit(String, Int32) method returns true if the character at position index in s is a letter or a decimal digit; otherwise, false.

Example

The following code example demonstrates IsLetterOrDigit.


//from   w w  w  . ja  v a  2 s .  c o  m
using System;

public class IsLetterOrDigitSample {
  public static void Main() {
    string str = "newline:\n";

    Console.WriteLine(Char.IsLetterOrDigit(str, 8));  // Output: "False", because it's a newline
  }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version