aqString Object

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

The aqString object lets you perform various operations on string values.

The object is available in TestComplete by default.

Members

Example

The code below divides the specified string into characters and posts them to the test log.

JavaScript, JScript

function StringByLetter()
{
  
  // Specifies the string
  var aString = "Per aspera ad astra";
  Log.Message("The string is : " + aString);
  Log.Message("And now, this text letter by letter using the GetChar method:");
  
  // Posts the specified string letter by letter to the test log
  for (var i = 0; i < aqString.GetLength(aString); i++)
    Log.Message(aqString.GetChar(aString, i));
  
}

Python

def StringByLetter():
  # Specifies the string 
  aString = "Per aspera ad astra"
  Log.Message("The string is : " + aString)
  Log.Message("And now, this text letter by letter using the GetChar method:")
  # Posts the specified string letter by letter to the test log
  for i in range(0, aqString.GetLength(aString)):
    Log.Message(aqString.GetChar(aString, i))

VBScript

Sub StringByLetter
  Dim aString, i
  
  ' Specifies the string
  aString = "Per aspera ad astra"
  Log.Message("The string is : " & aString)
  Log.Message("And now, this text letter by letter using the GetChar method:")
  
  ' Posts the specified string letter by letter to the test log
  For i = 0 To aqString.GetLength(aString)-1
    Log.Message(aqString.GetChar(aString, i))
  Next
  
End Sub

DelphiScript

function StringByLetter;
var aString, i;
begin

  // Specifies the string
  aString := 'Per aspera ad astra';
  Log.Message('The string is : ' + aString);
  Log.Message('And now, this text letter by letter using the GetChar method:');
  
  // Posts the specified string letter by letter to the test log
  for i := 0 to aqString.GetLength(aString)-1 do
    Log.Message(aqString.GetChar(aString, i));
  
end;

C++Script, C#Script

function StringByLetter()
{
  
  // Specifies the string
  var aString = "Per aspera ad astra";
  Log["Message"]("The string is : " + aString);
  Log["Message"]("And now, this text letter by letter using the GetChar method:");
  
  // Posts the specified string letter by letter to the test log
  for (var i = 0; i < aqString["GetLength"](aString); i++)
    Log["Message"]( aqString["GetChar"](aString, i) );
  
}

See Also

Working With Strings
TestComplete Helper Objects
aqConvert Object
aqDateTime Object
aqEnvironment Object
aqFile Object
aqFileSystem Object
aqObject Object
aqUtils Object

Highlight search results