Runtime verified Test scripts included

Returns the 1-based position of a substring within a string (case-insensitive).

Syntax

{{indexOf subject search}}

Returns integer.

Parameters

Name Type Required Description
subject string Yes String to search.
search string Yes The string to find.

Example

Tested in a Marketing Cloud Next email on 2026-11-22:

  • {{indexOf "Hello World" "world"}} renders 7, as documented.
  • {{indexOf "abc" "z"}} renders 0, as documented.
Show Next test script
<!-- Marketing Cloud Next test script for the indexOf helper. Paste it into the HTML component of a
     Next email and open the preview. Each line prints the result Next gave when the call
     was rendered on its own (expect) next to the result of this run (got).
     Assembled from single-call test emails (dates on the page); it has not been
     run as one email. Calls that make Next fail are listed separately. -->
<p>c1 expect=[7] got=[{{indexOf "Hello World" "world"}}]</p>
<p>c2 expect=[0] got=[{{indexOf "abc" "z"}}]</p>

Marketing Cloud Next

Works as documented

Every tested call rendered the documented result. Tested 2026-11-22 by rendering in a Marketing Cloud Next email.

See also