strings.compare() function
strings.compare()
compares the lexicographical order of two strings.
Return values
Comparison | Return value |
---|---|
v < t | -1 |
v == t | 0 |
v > t | 1 |
Function type signature
(t: string, v: string) => int
Parameters
v
(Required) String value to compare.
t
(Required) String value to compare against.
Examples
Compare the lexicographical order of column values
import "strings"
data
|> map(fn: (r) => ({r with same: strings.compare(v: r.string1, t: r.string2)}))
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Flux and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.