Home  |  Delphi .net Home  |  System.Char  |  Parse Method
Converts a string representation of a Char into a Char value
Char Structure
System NameSpace
CF1.  Function Parse ( Value : String ) : Char; Static;
CF : Methods with this mark are Compact Framework Compatible
Attempts to parse the Value string into a value between 0 and 255, returning a Byte object with this value.
The Style parameter determines the allowed number content. It is an enumerated type that is treated as a set of flags (it has the [Flags] attribute. This means that multiple values may be set, using logical or. The possible values are :
AllowCurrencySymbol Allow for ?,$ ...
AllowExponentE+000 format
AllowThousandsFor example : 1,000,000
AllowDecimalPointFor example : 123.456
AllowParenthesesFor example (1234)
AllowTrailingSignFor example : 123-
AllowLeadingSignFor example : -123
AllowTrailingWhiteAllow trailing blanks
AllowLeadingWhiteAllow leading blanks
AllowHexSpecifierFor example : 0x2bcd

Note that only a few of these allowances are meaningful for byte values.
The FormatProvider option allows for customised formatting and is beyond the scope of Delphi Basics.
Warning : An exception is thrown if the parse encounters unexpected characters - it is looking for a single character.

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

 Buy Website Traffic at

 Buy Proxies at
A simple example
program Project1;

  charStr : String;
  result  : Char;

  charStr := 'A';
  result  := System.Char.Parse(charStr);
  Console.WriteLine('''' + charStr + ''' parses to ' +  result);

   'A' parses to A
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author