startsWith() | Zoho QEngine Help

startsWith()

In a nutshell
The startsWith() function performs a case-sensitive search to see if a string begins with a specified searchString. It takes a string and the search string as arguments and returns True if the string begins with the searchString and False if the string does not begin. It is useful in test scripts where you need to validate that a text value starts with a specific prefix.

Overview

The startsWith() function takes a string and a searchString as arguments. It returns True if searchString is found at the beginning of the string. Otherwise, it returns False.

NotesNote: This function performs a case-sensitive search.

Return Type

  • Boolean

Syntax

  1. <variable> = <string>.startsWith( <searchString> );

(OR)

  1. <variable> = startsWith( <string>, <searchString> );
ParameterDescriptionData type
<variable>Variable which will contain the returned boolean value.BOOLEAN
<string>

The main string which may start with the searchString.

TEXT
<searchString>

The searchString with which the main string may start.

TEXT

Examples

  1. Product="Zoho QEngine";
  2. var = startsWith(Product, "Zoho");     //returns true
  3. Product="Zoho QEngine";
  4. var = startsWith(Product, "zoho");     //returns false