aqString.GetLength Method

Applies to TestComplete 15.63, last modified on April 10, 2024

Description

The GetLength method returns the total number of characters in the input string.

Declaration

aqString.GetLength(InputString)

InputString [in]    Required    String    
Result Integer

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

InputString

Specifies the string whose length should be calculated.

Result Value

The number of characters in the specified string.

Example

The code below posts the length of the specified string to the test log.

JavaScript, JScript

function StringLengthDemo()
{

  // Specifies the string
  var aString = "Some text";
  
  // Posts the string length to the test log
  Log.Message("The string is " + aqString.GetLength(aString) + " character(s) long.");
  
}

Python

def StringLengthDemo():
  # Specifies the string
  aString = "Some text"
  # Posts the string length to the test log
  Log.Message("The string is " + str(aqString.GetLength(aString)) + " character(s) long.")

VBScript

Sub StringLengthDemo
  Dim aString
  
  ' Specifies the string
  aString = "Some text"
  
  ' Posts the string length to the test log
  Log.Message("The string is " & aqString.GetLength(aString) & " character(s) long.")
  
End Sub

DelphiScript

function StringLengthDemo;
var aString;
begin

  // Specifies the string
  aString := 'Some text';
  
  // Posts the string length to the test log
  Log.Message('The string is ' + IntToStr( aqString.GetLength(aString) ) + ' character(s) long.');
  
end;

C++Script, C#Script

function StringLengthDemo()
{

  // Specifies the string
  var aString = "Some text";
  
  // Posts the string length to the test log
  Log["Message"]("The string is " + aqString["GetLength"](aString) + " character(s) long.");
  
}

See Also

Working With Strings
Find Method
GetChar Method
GetListLength Method
Insert Method
Remove Method
SubString Method

Highlight search results