Add trim/0, ltrim/0 and rtrim/0 that trims leading and trailing whitespace (#3056)

This commit is contained in:
Mattias Wadman authored and GitHub committed 2024-03-20 11:04:17 +01:00
1 parent 81f4f883ac
commit be437ec049
7 files changed
+144

No files matched your search

+19
View File
@@ -1772,6 +1772,25 @@ sections:
input: '["fo", "foo", "barfoo", "foobar", "foob"]'
output: ['["fo","","bar","foobar","foob"]']
- title: "`trim`, `ltrim`, `rtrim`"
body: |
`trim` trims both leading and trailing whitespace.
`ltrim` trims only leading (left side) whitespace.
`rtrim` trims only trailing (right side) whitespace.
Whitespace characters are the usual `" "`, `"\n"` `"\t"`, `"\r"`
and also all characters in the Unicode character database with the
whitespace property. Note that what considers whitespace might
change in the future.
examples:
- program: 'trim, ltrim, rtrim'
input: '" abc "'
output: ['"abc"', '"abc "', '" abc"']
- title: "`explode`"
body: |