BuiltIn.StrContains 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 one string contains another as a substring.

Declaration

BuiltIn.StrContains(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 test for occurrences of SubStr.

CaseSensitive

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

Result Value

True if the specified substring was found and False otherwise.

Remarks

This method is obsolete. It is supported for backward compatibility only. To check whether a string contains a substring, use the aqString.Find method.

Example

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

JavaScript, JScript

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

Python

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

VBScript

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

DelphiScript

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

C++Script, C#Script

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

See Also

Find Method

Highlight search results