DirectoryRoot

Function DirectoryRoot(dirpath: String) : String
Returns a path as a string

This function makes it easy to manipulate file paths. It goes to the root of a path.

Example:

Program
  Uses
basilisk, pure2d

Begin
  InitBasilisk(TRUE)
  OpenScreen(640,480,32,FALSE,COB_SHOWCLOSE+COB_SHOWBORDER)
  
  Text(10,10,"C:\myfolder\another\yetanother\myfile.txt -> "+DirectoryRoot("C:\myfolder\another\yetanother\myfile.txt"))
  Text(10,30,"/home/user/ -> "+DirectoryRoot("/home/user"))
  Text(10,50,"data\media\ -> "+DirectoryRoot("data\media\"))
  Text(10,70,"http://www.socoder.net/index.php -> "+DirectoryRoot("http://www.socoder.net/index.php"))
  
  While Not ExitRequested
   Flip
   Pause
(2)
  Wend
     
End