aqString.Remove Method

Applies to TestComplete 15.45, last modified on December 01, 2022

Description

Use the Remove method to exclude a text fragment starting from the specified position and having the specified length.

Declaration

aqString.Remove(InputString, StartPosition, Length)

InputString [in]    Required    String    
StartPosition [in]    Required    Integer    
Length [in]    Required    Integer    
Result String

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

InputString

Specifies the string from which a substring will be removed.

StartPosition

A zero-based position of the first character to remove.

Length

The number of characters to be removed.

Result Value

The string lacking the specified fragment.

Example

The code below removes a fragment from the specified string and then posts the derived string to the test log.

JavaScript, JScript

function RemovingSubString()
{
  var Str = "123456789";
  var StartPos = 3;
  var sLength = 4;
  var Res = aqString.Remove(Str, StartPos, sLength);
  
  Log.Message(Res); // Posts "12389"
}

Python

def RemovingSubString():
  Str = "123456789"
  StartPos = 3
  sLength = 4
  Res = aqString.Remove(Str, StartPos, sLength)
  Log.Message(Res) # Posts "12389"

VBScript

Sub RemovingSubString

  Str = "123456789"
  StartPos = 3
  sLength = 4
  Res = aqString.Remove(Str, StartPos, sLength)
  
  Log.Message(Res) ' Posts "12389"
  
End Sub

DelphiScript

function RemovingSubString;
var Str, StartPos, sLength, Res;
begin
  Str := '123456789';
  StartPos := 3;
  sLength := 4;
  Res := aqString.Remove(Str, StartPos, sLength);
  
  Log.Message(Res); // Posts '12389'
end;

C++Script, C#Script

function RemovingSubString()
{
  var Str = "123456789";
  var StartPos = 3;
  var sLength = 4;
  var Res = aqString["Remove"]( Str, StartPos, sLength );
  
  Log["Message"](Res); // Posts "12389"
}

See Also

Working With Strings
Insert Method
SubString Method
Replace Method

Highlight search results