Skip to content

Commit c47d80b

Browse files
authored
Merge pull request #251 from rwtolbert/examples_string_47trim
add examples for string/trim
2 parents 56f2acd + 3cdb075 commit c47d80b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

examples/string_47trim.janet

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# trim leading and trailing whitespace
2+
(string/trim " foo ") # -> "foo"
3+
4+
# default whitespace includes " \t\r\n\v\f"
5+
(string/trim "\t bar\n\r\f") # -> "bar"
6+
7+
# provide custom set of characters to trim
8+
(string/trim "_.foo_bar. \n" " ._\n") # -> "foo_bar"

0 commit comments

Comments
 (0)