Back to Influxdb

strings.equalFold() function

content/flux/v0/stdlib/strings/equalfold.md

latest2.2 KB
Original Source
<!------------------------------------------------------------------------------ IMPORTANT: This page was generated from comments in the Flux source code. Any edits made directly to this page will be overwritten the next time the documentation is generated. To make updates to this documentation, update the function comments above the function definition in the Flux source code: https://github.com/influxdata/flux/blob/master/stdlib/strings/strings.flux#L350-L350 Contributing to Flux: https://github.com/influxdata/flux#contributing Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md ------------------------------------------------------------------------------->

strings.equalFold() reports whether two UTF-8 strings are equal under Unicode case-folding.

Function type signature
js
(t: string, v: string) => bool

{{% caption %}} For more information, see Function type signatures. {{% /caption %}}

Parameters

v

({{< req >}}) String value to compare.

t

({{< req >}}) String value to compare against.

Examples

Ignore case when comparing two strings

js
import "strings"

data
    |> map(fn: (r) => ({r with same: strings.equalFold(v: r.string1, t: r.string2)}))

{{< expand-wrapper >}} {{% expand "View example input and output" %}}

Input data

timestring1string2
2022-01-01T00:00:00ZRJqcVGNlcJrjQCvGNLCj
2022-01-01T00:01:00ZhBumdSljCQunfbcNAXUA
2022-01-01T00:02:00ZITcHyLZuquKKtCcRHsKj
2022-01-01T00:03:00ZHyXdjvrjgphyxDJvrJGP
2022-01-01T00:04:00ZSVepvUBAVxGuKKjuGsyI

Output data

samestring1string2time
trueRJqcVGNlcJrjQCvGNLCj2022-01-01T00:00:00Z
falsehBumdSljCQunfbcNAXUA2022-01-01T00:01:00Z
falseITcHyLZuquKKtCcRHsKj2022-01-01T00:02:00Z
trueHyXdjvrjgphyxDJvrJGP2022-01-01T00:03:00Z
falseSVepvUBAVxGuKKjuGsyI2022-01-01T00:04:00Z

{{% /expand %}} {{< /expand-wrapper >}}