strings.hasSuffix() function

The strings.hasSuffix() function indicates if a string ends with a specified suffix.

*Output data type: Boolean*

  1. import "strings"
  2. strings.hasSuffix(v: "go gopher", suffix: "go")
  3. // returns false

Parameters

v

The string value to search.

*Data type: String*

suffix

The suffix to search for.

*Data type: String*

Filter based on the presence of a suffix in a column value
  1. import "strings"
  2. data
  3. |> filter(fn:(r) => strings.hasSuffix(v: r.metric, suffix: "_count" ))

Related articles