aqString.Concat Method

Applies to TestComplete 15.69, last modified on November 13, 2024

Description

Use the Concat method to make a single string out of two substrings. The string specified by the String2 parameter is appended to String1.

Declaration

aqString.Concat(String1, String2)

String1 [in]    Required    String    
String2 [in]    Required    String    
Result String

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

String1 and String2

Specify the strings to be concatenated.

Result Value

The string that contains both the String1 and String2 strings.

Example

The code below demonstrates how you can use the Concat method to concatenate two or more strings.

JavaScript, JScript

function ConcatenationStrings()
{
  var Str1 = "String No 1 ";
  // Posts the "String No 1 String No 2" string to the test log
  Log.Message( aqString.Concat(Str1, "String No 2") );
  // Posts the "String No 1 String No 2 String No 3" string to the test log
  Log.Message( Str1 + "String No 2 " + "String No " + aqConvert.IntToStr(3) );
  Log.Message(Str1 + "String No 2 " + "String No " + 3);
}

Python

def ConcatenationStrings():
  Str1 = "String No 1 "
  # Posts the "String No 1 String No 2" string to the test log
  Log.Message(aqString.Concat(Str1, "String No 2"))
  # Posts the "String No 1 String No 2 String No 3" string to the test log
  Log.Message(Str1 + "String No 2 " + "String No " + aqConvert.IntToStr(3))
  Log.Message(Str1 + "String No 2 " + "String No " + str(3))

VBScript

Sub ConcatenationStrings
  Dim Str1
  Str1 = "String No 1 "
  ' Posts the "String No 1 String No 2" string to the test log
  Log.Message(aqString.Concat(Str1, "String No 2"))
  ' Posts the "String No 1 String No 2 String No 3" string to the test log
  Log.Message(Str1 + "String No 2 " + "String No " + aqConvert.IntToStr(3))
  Log.Message(Str1 & "String No 2 " & "String No " & 3)
End Sub

DelphiScript

function ConcatenationStrings;
var Str1;
begin
  Str1 := 'String No 1 ';
  // Posts the "String No 1 String No 2" string to the test log
  Log.Message( aqString.Concat(Str1, 'String No 2') );
  // Posts the "String No 1 String No 2 String No 3" string to the test log
  Log.Message( Str1 + 'String No 2 ' + 'String No ' + aqConvert.IntToStr(3) );
end;

C++Script, C#Script

function ConcatenationStrings()
{
  var Str1 = "String No 1 ";
  // Posts the "String No 1 String No 2" string to the test log
  Log["Message"]( aqString["Concat"](Str1, "String No 2") );
  // Posts the "String No 1 String No 2 String No 3" string to the test log
  Log["Message"]( Str1 + "String No 2 " + "String No " + aqConvert["IntToStr"](3) );
  Log["Message"]( Str1 + "String No 2 " + "String No " + 3 );
}

See Also

Working With Strings
Find Method
Insert Method
Remove Method

Highlight search results