Home  |  Delphi .net Home  |  System.Char  |  IsSymbol Method
IsSymbol  
Method  
Returns true if a given character is a symbol character
Char Structure
System NameSpace
CF1.  Function IsSymbol ( UnicodeChar : Char; ) : Boolean;
NotCF2.  Function IsSymbol ( 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 symbol character.
 
Examples of symbol characters :
 
+-/= Mathematical symbols
$? Currency symbols
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
  myChar : Char;
  myStr  : String;

begin
  myChar := '(';

  if System.Char.IsSymbol(myChar)
  then Console.WriteLine(myChar + ' is a symbol character')
  else Console.WriteLine(myChar + ' is not a symbol character');

  myStr := '12+9=21';
  if System.Char.IsSymbol(myStr, 2)  // Note 0 based index
  then Console.WriteLine(myStr[3] + ' is a symbol character') // 1 based
  else Console.WriteLine(myStr[3] + ' is not a symbol character');

  Console.ReadLine;
end.
Show full unit code
  ( is not a symbol character
  + is a symbol character
 
 
Delphi Programming © Neil Moffatt All rights reserved.  |  Contact the author