Home  |  Delphi .net Home  |  System.Boolean  |  Parse Method
  
Parse  
Method  
Converts a string representation of a Boolean into a Boolean value
Boolean Structure
System NameSpace
CF1.  Function Parse ( Value : String ) : Boolean; Static;
CF : Methods with this mark are Compact Framework Compatible
Description
Attempts to parse the Value string into a true or false value, returning a Boolean object with the appropriate value.
Notes
Warning : An exception is thrown if the parse encounters unexpected characters.
Microsoft MSDN Links
System
System.Boolean
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

var
  boolStr : String;

begin
  boolStr := 'true';
  if System.Boolean.Parse(boolStr)
  then Console.WriteLine('''' + boolStr + '''    parses to true')
  else Console.WriteLine('''' + boolStr + '''   parses to false');

  boolStr := ' True ';
  if System.Boolean.Parse(boolStr)
  then Console.WriteLine('''' + boolStr + '''  parses to true')
  else Console.WriteLine('''' + boolStr + '''  parses to false');

  boolStr := ' FALSE ';
  if System.Boolean.Parse(boolStr)
  then Console.WriteLine('''' + boolStr + ''' parses to true')
  else Console.WriteLine('''' + boolStr + ''' parses to false');

  Console.ReadLine;
end.
   'true'    parses to true
   ' True '  parses to true
   ' FALSE ' parses to false
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author