Add trimstr/1 function (#3319)

This commit is contained in:
Gabriel Marin authored and GitHub committed 2025-05-21 18:46:04 +09:00
1 parent de21386681
commit 7d8c096e48
5 files changed
+35

No files matched your search

+11
View File
@@ -1798,6 +1798,17 @@ sections:
input: '["fo", "foo", "barfoo", "foobar", "foob"]'
output: ['["fo","","bar","foobar","foob"]']
- title: "`trimstr(str)`"
body: |
Outputs its input with the given string removed at both ends, if it
starts or ends with it.
examples:
- program: '[.[]|trimstr("foo")]'
input: '["fo", "foo", "barfoo", "foobarfoo", "foob"]'
output: ['["fo","","bar","bar","b"]']
- title: "`trim`, `ltrim`, `rtrim`"
body: |