aqFileSystem.ExcludeTrailingBackSlash Method

Applies to TestComplete 15.70, last modified on December 17, 2024

Description

The ExcludeTrailingBackSlash method checks whether the specified path ends with a trailing path delimiter ('\') and removes it if it is found.

Declaration

aqFileSystem.ExcludeTrailingBackSlash(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 holds the specified path with the trailing path delimiter ('\') removed.

Example

The code below excludes the trailing back slash from the specified folder path.

JavaScript, JScript

function ExcludeBackSlashExample()
{
  // Specifies a folder path
 var sPath = "C:\\Temp\\";
  
  // Obtains the folder path without the trailing back slash
 var sPathExclude = aqFileSystem.ExcludeTrailingBackSlash(sPath);

  // Posts the path without the trailing back slash to the test log
 Log.Message("The folder path is " + sPathExclude);
 
}

/*
The routine produces the following output:

The folder path is C:\Temp
*/

Python

def ExcludeBackSlashExample():
  # Specifies a folder path
  sPath = "C:\\Temp\\"
  # Obtains the folder path without the trailing back slash
  sPathExclude = aqFileSystem.ExcludeTrailingBackSlash(sPath)
  # Posts the path without the trailing back slash to the test log
  Log.Message("The folder path is " + sPathExclude)
  
# The routine produces the following output:
# The folder path is C:\Temp

VBScript

Sub ExcludeBackSlashExample

  ' Specifies a folder path
 sPath = "C:\Temp\"
  
  ' Obtains the folder path without the trailing back slash
 sPathExclude = aqFileSystem.ExcludeTrailingBackSlash(sPath)

  ' Posts the path without the trailing back slash to the test log
 Log.Message("The folder path is " + sPathExclude)
 
End Sub

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

DelphiScript

function ExcludeBackSlashExample;
var sPath, sPathExclude;
begin
  // Specifies a folder path
 sPath := 'C:\Temp\';
  
  // Obtains the folder path without the trailing back slash
 sPathExclude := aqFileSystem.ExcludeTrailingBackSlash(sPath);

  // Posts the path without the trailing back slash to the test log
 Log.Message('The folder path is ' + sPathExclude);
 
end;

{
The routine produces the following output:

The folder path is C:\Temp
}

C++Script, C#Script

function ExcludeBackSlashExample()
{
  // Specifies a folder path
 var sPath = "C:\\Temp\\";
  
  // Obtains the folder path without the trailing back slash
 var sPathExclude = aqFileSystem["ExcludeTrailingBackSlash"](sPath);

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

/*
The routine produces the following output:

The folder path is C:\Temp
*/

See Also

Working With Files From Scripts
IncludeTrailingBackSlash Method

Highlight search results