Text.PositionOfAny

About

Returns the first occurrence of a text value in list and returns its position starting at startOffset.

Syntax

Text.PositionOfAny(string as text, list as list, optional occurrence as nullable number) as number  

Arguments

Argument Description
string The string to search for.
list The list to search through.
optional occurrence An enum that controls the scope of operation.

Settings

Setting Description
Occurrence.First or Occurrence.Last A single position is returned.
Occurrence.All A list of positions is returned for all occurrences.

Remarks

  • If the text values are not found in the list, -1 is returned.

Examples

List.PositionOfAny("ABCD", {"B","C"}) equals 1  
List.PositionOfAny("ABCBA", {"A","B"}, Occurrence.First) equals 0  
List.PositionOfAny("ABCBA", {"A","B"}, Occurrence.Last) equals 4  
List.PositionOfAny("ABCBA", {"A","B"}, Occurrence.All) equals {0,1,3,4}