| Description |
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 ?,$ ... |
| AllowExponent | E+000 format |
| AllowThousands | For example : 1,000,000 |
| AllowDecimalPoint | For example : 123.456 |
| AllowParentheses | For example (1234) |
| AllowTrailingSign | For example : 123- |
| AllowLeadingSign | For example : -123 |
| AllowTrailingWhite | Allow trailing blanks |
| AllowLeadingWhite | Allow leading blanks |
| AllowHexSpecifier | For 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.
|
| | Notes | 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 |
System
System.Char
|
|
|
| A simple example |
program Project1;
{$APPTYPE CONSOLE}
var
charStr : String;
result : Char;
begin
charStr := 'A';
result := System.Char.Parse(charStr);
Console.WriteLine('''' + charStr + ''' parses to ' + result);
Console.ReadLine;
end.
| | Show full unit code | 'A' parses to A
|
| |
|
|
|