Home  |  Delphi .net Home  |  System.Char  |  IsLetterOrDigit Method
  
IsLetterOrDigit  
Method  
Returns true if a given character is a letter or digit
Char Structure
System NameSpace
CF1.  Function IsLetterOrDigit ( UnicodeChar : Char ) : Boolean; Static;
NotCF2.  Function IsLetterOrDigit ( CharString : String; Index : Integer ) : Boolean; Static;
CF : Methods with this mark are Compact Framework Compatible
Description
Returns true if the Unicode character, or the character at Index position in CharString is a letter or digit.
Notes
Very Important : Methods in .Net treat strings as starting at 0, unlike traditional Delphi where they started at 1.

Static methods are not methods of an object - they are simply class functions or procedures available at any time.
Microsoft MSDN Links
System
System.Char
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 
 
An example of both syntaxes
program Project1;
{$APPTYPE CONSOLE}

var
  myStr : String;
  i     : Integer;

begin
  if System.Char.IsLetterOrDigit('1')
  then Console.WriteLine('a is a letter or digit')
  else Console.WriteLine('a is not a letter or digit');

  myStr := '[AaBb12]';

  for i := 0 to Length(myStr)-1 do  // Note : 0 based
    if System.Char.IsLetterOrDigit(myStr, i)
    then Console.WriteLine(myStr[i+1] + ' is a letter or digit')
    else Console.WriteLine(myStr[i+1] + ' is not a letter or digit');

  Console.ReadLine;
end.
   a is a letter or digit
   [ is not a letter or digit
   A is a letter or digit
   a is a letter or digit
   B is a letter or digit
   b is a letter or digit
   1 is a letter or digit
   2 is a letter or digit
   ] is not a letter or digit
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author