ReplaceFirstIgnoreCase()
Table of Contents
Overview
The replaceFirstIgnoreCase() function searches for searchText in the inputText and replaces its first occurrence with the replacementText. If the searchText is not found, this function returns the inputText as it is.
Note:
- This task performs a case-insensitive search. In order to perform a case-sensitive search, use the replaceFirst built-in function.
- The size of each input and output parameter of this function can individually be up to 300 KB.
Return Type
- TEXT
Syntax
<variable> = <inputText>.replaceFirstIgnoreCase(<searchText>, <replacementText>, <boolean>);
(OR)
<variable> = replaceFirstIgnoreCase(<inputText>, <searchText>, <replacementText>, <boolean>);
Parameter | Data type | Description |
---|---|---|
<variable> | TEXT | Variable which will contain the returned text. |
<inputText> | TEXT | The text in which the first occurrence of searchText will be replaced with replacementText. |
<searchText> | TEXT |
|
<replacementText> | TEXT | This replacementText will replace the first occurrence of searchText in the inputText. |
<boolean> | TEXT | Applicable values: true or false. By default, the replaceFirstIgnoreCase() function supports regular expression (i.e) it will not find and replace the special characters like $ in the input text. This parameter can be used to specify if the regular expression is to be supported or escaped.
|
Example
The following example searches for the text - ZOHO in the inputText and replaces all of its occurrences with Z.
inputText = "Zoho Creator, Zoho Desk, Zoho CRM"; newText = replaceFirstIgnoreCase(inputText,"ZOHO ","Z"); // returns "ZCreator, Zoho Desk, Zoho CRM" info newText;