added string package flux functions
parent
d5e50b1dcf
commit
de96dd5bc3
|
|
@ -9,8 +9,6 @@ weight: 101
|
|||
---
|
||||
|
||||
Flux's functional syntax allows you to retrieve, transform, process, and output data easily.
|
||||
There is a large library of built-in and importable functions.
|
||||
You can also [create your own custom functions](/v2.0/query-data/guides/custom-functions)
|
||||
to perform operations that suit your needs.
|
||||
There is a large library of built-in and importable functions:
|
||||
|
||||
{{< children >}}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
---
|
||||
title: Built-in Flux functions
|
||||
description: placeholder
|
||||
description: >
|
||||
Built-in functions provide a necessary foundation for working with data using Flux.
|
||||
They do not require an import statement and are usable without any extra setup.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: Built-in
|
||||
|
|
@ -8,4 +10,9 @@ menu:
|
|||
weight: 201
|
||||
---
|
||||
|
||||
Placeholder
|
||||
Built-in functions provide a necessary foundation for working with data using Flux.
|
||||
Because these functions are "built-in," they do not require an `import` statement and are usable without any extra setup.
|
||||
|
||||
Built-in functions are grouped into the following categories:
|
||||
|
||||
{{< children >}}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
---
|
||||
title: InfluxDB v1 Flux functions
|
||||
description: placeholder
|
||||
description: >
|
||||
InfluxDB v1 Flux functions provide tools for managing data from an InfluxDB v1.x database.
|
||||
To use them, import the "influxdata/influxdb/v1" package.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: InfluxDB v1
|
||||
|
|
@ -8,4 +10,11 @@ menu:
|
|||
weight: 202
|
||||
---
|
||||
|
||||
Placeholder
|
||||
InfluxDB v1 Flux functions provide tools for managing data from an InfluxDB v1.x database.
|
||||
To use them, import the `influxdata/influxdb/v1` package:
|
||||
|
||||
```js
|
||||
import "influxdata/influxdb/v1"
|
||||
```
|
||||
|
||||
{{< children type="functions" show="pages" >}}
|
||||
|
|
|
|||
|
|
@ -8,4 +8,11 @@ menu:
|
|||
weight: 203
|
||||
---
|
||||
|
||||
Placeholder
|
||||
String functions provide tools for manipulating strings in flux.
|
||||
To use them, import the `strings` package:
|
||||
|
||||
```js
|
||||
import "strings"
|
||||
```
|
||||
|
||||
{{< children type="functions" show="pages" >}}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
title: strings.title() function
|
||||
description: The strings.title() function converts a string to title case.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: strings.title
|
||||
parent: Strings
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `strings.title()` function converts a string to title case.
|
||||
|
||||
_**Output data type:** String_
|
||||
|
||||
```js
|
||||
import "strings"
|
||||
|
||||
strings.title(v: "a flux of foxes")
|
||||
|
||||
// returns "A Flux Of Foxes"
|
||||
```
|
||||
|
||||
## Paramters
|
||||
|
||||
### v
|
||||
The string value to convert.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
## Examples
|
||||
|
||||
###### Convert all values of a column to title case
|
||||
```js
|
||||
import "strings"
|
||||
|
||||
data
|
||||
|> map(fn:(r) => strings.title(v: r.pageTitle))
|
||||
```
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
title: strings.toLower() function
|
||||
description: The strings.toLower() function converts a string to lower case.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: strings.toLower
|
||||
parent: Strings
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `strings.toLower()` function converts a string to lower case.
|
||||
|
||||
_**Output data type:** String_
|
||||
|
||||
```js
|
||||
import "strings"
|
||||
|
||||
strings.toLower(v: "KOALA")
|
||||
|
||||
// returns "koala"
|
||||
```
|
||||
|
||||
## Paramters
|
||||
|
||||
### v
|
||||
The string value to convert.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
## Examples
|
||||
|
||||
###### Convert all values of a column to lower case
|
||||
```js
|
||||
import "strings"
|
||||
|
||||
data
|
||||
|> map(fn:(r) => strings.toLower(v: r.exclamation))
|
||||
```
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
title: strings.toUpper() function
|
||||
description: The strings.toUpper() function converts a string to upper case.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: strings.toUpper
|
||||
parent: Strings
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `strings.toUpper()` function converts a string to upper case.
|
||||
|
||||
_**Output data type:** String_
|
||||
|
||||
```js
|
||||
import "strings"
|
||||
|
||||
strings.toUpper(v: "koala")
|
||||
|
||||
// returns "KOALA"
|
||||
```
|
||||
|
||||
## Paramters
|
||||
|
||||
### v
|
||||
The string value to convert.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
## Examples
|
||||
|
||||
###### Convert all values of a column to upper case
|
||||
```js
|
||||
import "strings"
|
||||
|
||||
data
|
||||
|> map(fn:(r) => strings.toUpper(v: r.envVars))
|
||||
```
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
---
|
||||
title: strings.trim() function
|
||||
description: >
|
||||
The strings.trim() function removes leading and trailing characters specified
|
||||
in the cutset from a string.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: strings.trim
|
||||
parent: Strings
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `strings.trim()` function removes leading and trailing characters specified
|
||||
in the [`cutset`](#cutset) from a string.
|
||||
|
||||
_**Output data type:** String_
|
||||
|
||||
```js
|
||||
import "strings"
|
||||
|
||||
strings.trim(v: ".abc.", cutset: ".")
|
||||
|
||||
// returns "abc"
|
||||
```
|
||||
|
||||
## Paramters
|
||||
|
||||
### v
|
||||
The string value from which to trim characters.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### cutset
|
||||
The leading and trailing characters from trim from the string value.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
## Examples
|
||||
|
||||
###### Trim leading and trailing periods from all values in a column
|
||||
```js
|
||||
import "strings"
|
||||
|
||||
data
|
||||
|> map(fn:(r) => strings.trim(v: r.variables, cutset: "."))
|
||||
```
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
title: strings.trimSpace() function
|
||||
description: The strings.trimSpace() function removes leading and trailing spaces from a string.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: strings.trimSpace
|
||||
parent: Strings
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `strings.trimSpace()` function removes leading and trailing spaces from a string.
|
||||
|
||||
_**Output data type:** String_
|
||||
|
||||
```js
|
||||
import "strings"
|
||||
|
||||
strings.trimSpace(v: " abc ")
|
||||
|
||||
// returns "abc"
|
||||
```
|
||||
|
||||
## Paramters
|
||||
|
||||
### v
|
||||
The string value from which to trim spaces.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
## Examples
|
||||
|
||||
###### Trim leading and trailing spaces from all values in a column
|
||||
```js
|
||||
import "strings"
|
||||
|
||||
data
|
||||
|> map(fn:(r) => strings.trimSpace(v: r.userInput))
|
||||
```
|
||||
Loading…
Reference in New Issue