Power Automate (WDL) function
indexOf — Power Automate (WDL) function reference
Position of a substring.
Syntax
wdl
indexOf(text, searchText)
Examples
wdl
indexOf('a@b.com', '@')→ 1
wdl
substring(item()?['FullName'], 0, indexOf(item()?['FullName'], ' '))
→ The first name, split at the first space
wdl
if(equals(indexOf(item()?['Path'], '/archive/'), -1), 'active', 'archived')
→ "active" / "archived"
Common mistakes & gotchas
- Returns -1, not null, when the search text is not found — always compare against -1 rather than relying on empty()/coalesce() to detect "not found".
- indexOf() is case-insensitive in WDL (unlike equals() or contains()) — 'ABC' and 'abc' are considered a match.
Related Workflow Definition Language functions
From Strings