contains

contains

This topic describes the syntax and usage of the contains function in Zoho Creator .

Description

The contains function checks whether the main string string1 contains the substring string2.This function performs a case-sensitive search.

Syntax

string1.contains(string2)

(or)

contains(string1 , string2)
// This format is not supported in Script builder. Use free-flow scripting mode.

The contains function syntax has the following arguments.

string1 - Required. The main string from which you what to find the search string.

string2 - Required. The string to be searched for within the main string.

Return Value

Returns true if string2 parameter occurs within the main string, otherwise false.

Example

str1="Testing String";

str2="Test";

str1.contains(str2); // returns true

str1.contains(" "); // returns true

str1.contains("test "); // returns false

 

str1="Testing String";

str2="Test";

contains(str1,str2); // returns true

contains(str1, " "); // returns true

contains(str1, "test "); // returns false

Related Function

FunctionDescription
containsIgnoreCase (str1 , str2)Returns true if first argument string contains the second argument string, otherwise false. While doing search it ignores the case.
notContains (str1 , str2)Returns true if first argument string does not contain the second argument string, otherwise false.

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohocreator.com