Home  |  Delphi .net Home  |  System.IO.Path  |  IsPathRooted Method
  
IsPathRooted  
Method  
Returns True if the specified Path contains an absolute path
Path Class
System.IO NameSpace
CF1.  Function IsPathRooted ( PathString : String ) : Boolean; Static;
CF : Methods with this mark are Compact Framework Compatible
Description
The IsPathRooted method returns true if the path in the specified PathString is absolute, or false if it is relative to the current directory position.
Microsoft MSDN Links
System.IO
System.IO.Path
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

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

uses
  System.IO;

var
  PathString : String;

begin
  PathString := 'C:\DelphiBasics.txt';

  if System.IO.Path.IsPathRooted(PathString)
  then Console.WriteLine('"{0}" has an absolute path',
                         PathString)
  else Console.WriteLine('"{0}" has a relative path',
                         PathString);

  PathString := 'DelphiBasics.txt';

  if System.IO.Path.IsPathRooted(PathString)
  then Console.WriteLine('"{0}" has an absolute path',
                         PathString)
  else Console.WriteLine('"{0}" has a relative path',
                         PathString);

  Console.Readline;
end.
   "C:\DelphiBasics.txt" has an absolute path
   "DelphiBasics.txt" has a relative path
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author