aqFileSystem.IncludeTrailingBackSlash Method

Applies to TestComplete 15.48, last modified on March 01, 2023

Description

The IncludeTrailingBackSlash method verifies that the specified path ends with a trailing path delimiter ('\') and adds it if the delimiter is missing.

Declaration

aqFileSystem.IncludeTrailingBackSlash(PathToFolder)

PathToFolder [in]    Required    String    
Result String

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

PathToFolder

Specifies the desired path.

Result Value

A string that contains the given path with a trailing path delimiter ('\') at the end.

Example

The code below adds a trailing backslash to the end of the specified folder path.

JavaScript, JScript

function IncludeBackSlashExample()
{
  // Specifies a folder path
 var sPath = "C:\\Temp";
  
  // Obtains the folder path with a trailing backslash
 var sPathInclude = aqFileSystem.IncludeTrailingBackSlash(sPath);

  // Posts the path with the trailing backslash to the test log
 Log.Message("The folder path is " + sPathInclude);
 
}

/*
The routine produces the following output:

The folder path is C:\Temp\
*/

Python

def IncludeBackSlashExample():
  # Specifies a folder path
  sPath = "C:\\Temp"
  # Obtains the folder path with a trailing backslash
  sPathInclude = aqFileSystem.IncludeTrailingBackSlash(sPath)
  # Posts the path with the trailing backslash to the test log
  Log.Message("The folder path is " + sPathInclude)

# The routine produces the following output:
# The folder path is C:\Temp\

VBScript

Sub IncludeBackSlashExample

  ' Specifies a folder path
 sPath = "C:\Temp"
  
  ' Obtains the folder path with a trailing backslash
 sPathInclude = aqFileSystem.IncludeTrailingBackSlash(sPath)

  ' Posts the path with the trailing backslash to the test log
 Log.Message("The folder path is " + sPathInclude)
 
End Sub

' The routine produces the following output:
' The folder path is C:\Temp\

DelphiScript

function IncludeBackSlashExample;
var sPath, sPathInclude;
begin
  // Specifies a folder path
 sPath := 'C:\Temp';
  
  // Obtains the folder path with a trailing backslash
 sPathInclude := aqFileSystem.IncludeTrailingBackSlash(sPath);

  // Posts the path with the trailing backslash to the test log
 Log.Message('The folder path is ' + sPathInclude);
 
end;

{
The routine produces the following output:

The folder path is C:\Temp\
}

C++Script, C#Script

function IncludeBackSlashExample()
{
  // Specifies a folder path
 var sPath = "C:\\Temp";
  
  // Obtains the folder path with a trailing backslash
 var sPathInclude = aqFileSystem["IncludeTrailingBackSlash"](sPath);

  // Posts the path with the trailing back slash to the test log
 Log["Message"]("The folder path is " + sPathInclude);
 
}

/*
The routine produces the following output:

The folder path is C:\Temp\
*/

See Also

Working With Files From Scripts
ExcludeTrailingBackSlash Method

Highlight search results