Home  |  Delphi .net Home  |  System.Char  |  IsLetter Method
IsLetter  
Method  
Returns true if a given character is a letter
Char Structure
System NameSpace
CF1.  Function IsLetter ( UnicodeChar : Char; ) : Boolean;
NotCF2.  Function IsLetter ( CharString:StringCharString : 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.
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
 
 
An example of both syntaxes
program Project1;
{$APPTYPE CONSOLE}

var
  myStr : String;
  i     : Integer;

begin
  if System.Char.IsLetter('a')
  then Console.WriteLine('a is a letter')
  else Console.WriteLine('a is not a letter');

  myStr := '[AaBb12]';

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

  Console.ReadLine;
end.
Show full unit code
  a is a letter
  [ is not a letter
  A is a letter
  a is a letter
  B is a letter
  b is a letter
  1 is not a letter
  2 is not a letter
  ] is not a letter
 
 
Delphi Programming © Neil Moffatt All rights reserved.  |  Contact the author