---
title: strings.splitN() function
description: strings.splitN() splits a string on a specified separator and returns an array of i substrings.
url: https://docs.influxdata.com/flux/v0/stdlib/strings/splitn/
estimated_tokens: 716
product: Flux
version: v0
---

# strings.splitN() function

-   Flux 0.18.0+
-   View InfluxDB support

`strings.splitN()` splits a string on a specified separator and returns an array of `i` substrings.

##### Function type signature

```js
(i: int, t: string, v: string) => [string]
```

For more information, see [Function type signatures](/flux/v0/function-type-signatures/).

## Parameters

### v

(Required) String value to split.

### t

(Required) String value that acts as the separator.

### i

(Required) Maximum number of split substrings to return.

`-1` returns all matching substrings. The last substring is the unsplit remainder.

## Examples

### Split a string into an array of substrings

```js
import "strings"

strings.splitN(v: "foo, bar, baz, quz", t: ", ", i: 3)// Returns ["foo", "bar", "baz, quz"]

```

#### Related

-   [strings.split() function](/flux/v0/stdlib/strings/split/)
-   [strings.splitAfter() function](/flux/v0/stdlib/strings/splitafter/)
-   [strings.splitAfterN() function](/flux/v0/stdlib/strings/splitaftern/)
