BuiltIn.StrStartsWith Method

Applies to TestComplete 15.47, last modified on January 20, 2023
This method is obsolete. See the Remarks section below.

Description

Use this function to find out whether a substring is contained at the beginning of another string.

Declaration

BuiltIn.StrStartsWith(SubStr, Str, CaseSensitive)

SubStr [in]    Required    String    
Str [in]    Required    String    
CaseSensitive [in]    Optional    Boolean Default value: True   
Result Boolean

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

SubStr

Specifies a sought for substring.

Str

Specifies a string to be tested for occurrences of SubStr at the beginning.

CaseSensitive

An optional Boolean value that defines whether the search should be performed regarding or ignoring letter-case. By default, the search is case-sensitive.

Result Value

True if the specified substring was found in the beginning of a string and False otherwise.

Remarks

This method is obsolete. It is supported for backward compatibility only. To compare strings, use the methods of the aqString object.

Example

The following line of code searches for the occurrence of "ABRA" at the beginning of the string "abracadabra". Since the search is case insensitive, the result is True.

JavaScript, JScript

Log.Message( BuiltIn.StrStartsWith("ABRA", "abracadabra", false) );

Python

Log.Message(BuiltIn.StrStartsWith("ABRA", "abracadabra", False))

VBScript

Log.Message( BuiltIn.StrStartsWith("ABRA", "abracadabra", False) )

DelphiScript

Log.Message( BuiltIn.StrStartsWith('ABRA', 'abracadabra', false) );

C++Script, C#Script

Log["Message"]( BuiltIn["StrStartsWith"]("ABRA", "abracadabra", false) );

See Also

Find Method

Highlight search results