replaceFirstIgnoreCase

ReplaceFirstIgnoreCase()

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>);
ParameterData typeDescription
<variable>TEXTVariable which will contain the returned text.
<inputText>TEXTThe text in which the first occurrence of searchText will be replaced with replacementText.
<searchText>TEXT


The first occurrence of this searchText in the inputText will be replaced with replacementText.

<replacementText>TEXTThis 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.

  • The value true denotes escaping the regular expression.
  • The value false denotes supporting the regular expression. By default, the value is taken as "false".

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;

Related Links

Share this post : FacebookTwitter

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

Write to us: support@zohodeluge.com