Path
Overview
Helper class that performs operations on a file or directory path information.
Use case
You can use this class when you need to manipulate path information of file or folder, for example:
var FileName := "1.txt";
writeLn(System.IO.Path.GetExtension(FileName));
FileName := System.IO.Path.ChangeExtension("1.txt", "jpg");
writeLn(FileName);
writeLn(System.IO.Path.GetExtension(FileName));
Output:
.txt
1.jpg
.jpg
Location
- Reference: Sugar
- Namespace: Sugar.IO
ChangeExtension
class method ChangeExtension(FileName: not nullable String; NewExtension: String): not nullable String
static String! ChangeExtension(String! FileName, String NewExtension)
static func ChangeExtension(_ FileName: String, _ NewExtension: String) -> String
static String ChangeExtension(String FileName, String NewExtension)
Shared Function ChangeExtension(FileName As String, NewExtension As String) As String
Parameters:
- FileName:
- NewExtension:
class method Combine(BasePath: not nullable String; Path: not nullable String): not nullable String
static String! Combine(String! BasePath, String! Path)
static func Combine(_ BasePath: String, _ Path: String) -> String
static String Combine(String BasePath, String Path)
Shared Function Combine(BasePath As String, Path As String) As String
Parameters:
- BasePath:
- Path:
class method Combine(BasePath: not nullable String; Path1: not nullable String; Path2: not nullable String): not nullable String
static String! Combine(String! BasePath, String! Path1, String! Path2)
static func Combine(_ BasePath: String, _ Path1: String, _ Path2: String) -> String
static String Combine(String BasePath, String Path1, String Path2)
Shared Function Combine(BasePath As String, Path1 As String, Path2 As String) As String
Parameters:
- BasePath:
- Path1:
- Path2:
DirectorySeparatorChar
class property DirectorySeparatorChar: Char read;
class Char DirectorySeparatorChar { get; }
static var DirectorySeparatorChar: Char { get{} }
class Char DirectorySeparatorChar { __get; }
Shared ReadOnly Property DirectorySeparatorChar() As Char
GetExtension
class method GetExtension(FileName: not nullable String): not nullable String
static String! GetExtension(String! FileName)
static func GetExtension(_ FileName: String) -> String
static String GetExtension(String FileName)
Shared Function GetExtension(FileName As String) As String
Parameters:
- FileName:
GetFileName
class method GetFileName(FileName: not nullable String): not nullable String
static String! GetFileName(String! FileName)
static func GetFileName(_ FileName: String) -> String
static String GetFileName(String FileName)
Shared Function GetFileName(FileName As String) As String
Parameters:
- FileName:
GetFileNameWithoutExtension
class method GetFileNameWithoutExtension(FileName: not nullable String): not nullable String
static String! GetFileNameWithoutExtension(String! FileName)
static func GetFileNameWithoutExtension(_ FileName: String) -> String
static String GetFileNameWithoutExtension(String FileName)
Shared Function GetFileNameWithoutExtension(FileName As String) As String
Parameters:
- FileName:
GetFullPath
class method GetFullPath(RelativePath: not nullable String): not nullable String
static String! GetFullPath(String! RelativePath)
static func GetFullPath(_ RelativePath: String) -> String
static String GetFullPath(String RelativePath)
Shared Function GetFullPath(RelativePath As String) As String
Parameters:
- RelativePath:
GetParentDirectory
class method GetParentDirectory(FileName: not nullable String): String
static String GetParentDirectory(String! FileName)
static func GetParentDirectory(_ FileName: String) -> String
static String GetParentDirectory(String FileName)
Shared Function GetParentDirectory(FileName As String) As String
Parameters:
- FileName:
DirectorySeparatorChar
class property DirectorySeparatorChar: Char read;
class Char DirectorySeparatorChar { get; }
static var DirectorySeparatorChar: Char { get{} }
class Char DirectorySeparatorChar { __get; }
Shared ReadOnly Property DirectorySeparatorChar() As Char
ChangeExtension
class method ChangeExtension(FileName: not nullable String; NewExtension: String): not nullable String
static String! ChangeExtension(String! FileName, String NewExtension)
static func ChangeExtension(_ FileName: String, _ NewExtension: String) -> String
static String ChangeExtension(String FileName, String NewExtension)
Shared Function ChangeExtension(FileName As String, NewExtension As String) As String
Parameters:
- FileName:
- NewExtension:
class method Combine(BasePath: not nullable String; Path: not nullable String): not nullable String
static String! Combine(String! BasePath, String! Path)
static func Combine(_ BasePath: String, _ Path: String) -> String
static String Combine(String BasePath, String Path)
Shared Function Combine(BasePath As String, Path As String) As String
Parameters:
- BasePath:
- Path:
class method Combine(BasePath: not nullable String; Path1: not nullable String; Path2: not nullable String): not nullable String
static String! Combine(String! BasePath, String! Path1, String! Path2)
static func Combine(_ BasePath: String, _ Path1: String, _ Path2: String) -> String
static String Combine(String BasePath, String Path1, String Path2)
Shared Function Combine(BasePath As String, Path1 As String, Path2 As String) As String
Parameters:
- BasePath:
- Path1:
- Path2:
GetExtension
class method GetExtension(FileName: not nullable String): not nullable String
static String! GetExtension(String! FileName)
static func GetExtension(_ FileName: String) -> String
static String GetExtension(String FileName)
Shared Function GetExtension(FileName As String) As String
Parameters:
- FileName:
GetFileName
class method GetFileName(FileName: not nullable String): not nullable String
static String! GetFileName(String! FileName)
static func GetFileName(_ FileName: String) -> String
static String GetFileName(String FileName)
Shared Function GetFileName(FileName As String) As String
Parameters:
- FileName:
GetFileNameWithoutExtension
class method GetFileNameWithoutExtension(FileName: not nullable String): not nullable String
static String! GetFileNameWithoutExtension(String! FileName)
static func GetFileNameWithoutExtension(_ FileName: String) -> String
static String GetFileNameWithoutExtension(String FileName)
Shared Function GetFileNameWithoutExtension(FileName As String) As String
Parameters:
- FileName:
GetFullPath
class method GetFullPath(RelativePath: not nullable String): not nullable String
static String! GetFullPath(String! RelativePath)
static func GetFullPath(_ RelativePath: String) -> String
static String GetFullPath(String RelativePath)
Shared Function GetFullPath(RelativePath As String) As String
Parameters:
- RelativePath:
GetParentDirectory
class method GetParentDirectory(FileName: not nullable String): String
static String GetParentDirectory(String! FileName)
static func GetParentDirectory(_ FileName: String) -> String
static String GetParentDirectory(String FileName)
Shared Function GetParentDirectory(FileName As String) As String
Parameters:
- FileName: