strings.lastIndexAny() function

Warning! This page documents an earlier version of Flux, which is no longer actively developed. Flux v0.65 is the most recent stable version of Flux.

The strings.lastIndexAny() function returns the index of the last instance of any specified characters in a string. If none of the specified characters are present, the function returns -1.

Output data type: Integer

import "strings"

strings.lastIndexAny(v: "chicken", chars: "aeiouy")

// returns 5



The string value to search.

Data type: String


Characters to search for.

Data type: String


Find the last occurrence of characters from a string
import "strings"

  |> map(fn: (r) => ({
      r with
      charLastIndex: strings.lastIndexAny(v: r._field, chars: "_-")