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

Generated
+15
View File
@@ -1959,6 +1959,21 @@ jq \'[\.[]|rtrimstr("foo")]\'
.
.IP "" 0
.
.SS "trimstr(str)"
Outputs its input with the given string removed at both ends, if it starts or ends with it\.
.
.IP "" 4
.
.nf
jq \'[\.[]|trimstr("foo")]\'
["fo", "foo", "barfoo", "foobarfoo", "foob"]
=> ["fo","","bar","bar","b"]
.
.fi
.
.IP "" 0
.
.SS "trim, ltrim, rtrim"
\fBtrim\fR trims both leading and trailing whitespace\.
.