Files
releases/v1
WonjuLee 95090fa4eb Add strings.split_n built-in function (#8915)
### Why the changes in this PR are needed?

Policies often need only the first or last few parts of a split string,
but `split()` always returns every part. The common workarounds add
noise:

```rego
[name, email, _, _] := split(user, ";")
[name, email] := array.slice(split(user, ";"), 0, 2)
```
### What are the changes in this PR?

Adds `strings.split_n(x, delimiter, n)`:
- Positive n: returns the first n parts from the left
- Negative n: returns the last abs(n) parts from the right
- n=0: returns an empty array
- If abs(n) exceeds the number of parts, all parts are returned

### Notes to assist PR review:

Semantics follow the design agreed on in the review of #8361.

### Further comments:

Fixes #8344

This change was developed with AI assistance.

Signed-off-by: wonju lee <wonju@kia.com>
Co-authored-by: wonju lee <wonju@kia.com>
2026-07-28 08:39:21 -05:00
..
2026-07-24 10:15:07 +02:00
2025-10-10 17:51:02 +02:00
2026-07-24 10:15:07 +02:00
2026-05-13 13:11:27 +02:00
2024-12-12 15:27:34 +01:00