IndexOf (PQL)

Returns a the position of a string in a given string.

  • Returned Output: Numeric
  • Library: PQL \ Common \ String
  • Version: 2018.00.000
  • Compatibility:
    • Can be combined with and other PQL function throughout the application.
    • It CANNOT be used with MDX or VBA functions. But it can be used on MDX-based content in other parts of the application.

Syntax

IndexOf( <Text> , <Search Text> )

* Click on the function's arguments above for more details on the input values.

Comments
  • The input text string can be any alphanumeric set of characters.
  • The search text string can be any alphanumeric set of characters.
  • The position is zero based - meaning the first position is shown as "0".
Different Function types
  • This function is like the Excel "find" function.

Examples

This example returns 3 from the input string "apple" when trying to find the character "l".

IndexOf("apple","l")

This example returns 1 from the input string "apple" when trying to find the character "p". In this case, the first p in the word is used to find the position.

IndexOf("apple","p")

This example returns 2 from the input string "banana" when trying to find the characters "na".

IndexOf("banana","na")