jmespath / jmespath/jmespath.jep

Function proposal - split()

Open
#3 0 comments 6 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
10
Forks
3
PR merge metrics
No merged PRs in 30d

Description

Given a `string` - split string on a pattern:

For example in Javascript one might implement it as follows:

```javascript
registerFunction(
'split',
([splitChar, toSplit]) => {
return toSplit.split(splitChar);
},
[{ types: [TYPE_STRING] }, { types: [TYPE_STRING] }],
);
```

Examples:

```javascript
jmespath.search("foo-bar-baz", "split('-', @)")
// OUTPUTS: [ 'foo', 'bar', 'baz' ]

jmespath.search("foo-bar-baz", "split('*', @)")
// OUTPUTS: [ 'foo-bar-baz' ]
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.