Home  |  Delphi .net Home  |  System.Char  |  IsControl Method
  
IsControl  
Method  
Returns true if a given character is a control character
Char Structure
System NameSpace
CF1.  Function IsControl ( UnicodeChar : Char ) : Boolean; Static;
NotCF2.  Function IsControl ( 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 control character.
 
Examples of control characters :
 
Tab
10 Line feed
13 Carriage return
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
  myChar : Char;
  myStr  : String;

begin
  myChar := Chr(13);  // Carriage return

  if System.Char.IsControl(myChar)
  then Console.WriteLine('Chr(13) is a control character')
  else Console.WriteLine('Chr(13) is not a control character');

  myStr := '1234';
  if System.Char.IsControl(myStr, 2)    // Note 0 based index
  then Console.WriteLine(myStr[3] + ' is a control character') // 1 based
  else Console.WriteLine(myStr[3] + ' is not a control character');

  Console.ReadLine;
end.
   Chr(13) is a control character
   3 is not a control character
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author