blob: df1cbb43351c0085f3348f96dc44892045aebac7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
'\" t
.\" Copyright (c) 2025 Bruce Hill
.\" All rights reserved.
.\"
.TH Text.trim 3 2025-04-21 "Tomo man-pages"
.SH NAME
Text.trim \- trim characters
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Text.trim\ :\ func(text:\ Text,\ to_trim:\ Text\ =\ "\ $\[rs]t\[rs]r\[rs]n",\ left:\ Bool\ =\ yes,\ right:\ Bool\ =\ yes\ ->\ Text)
.fi
.SH DESCRIPTION
Trims the given characters (grapheme clusters) from the left and/or right side of the text.
.SH ARGUMENTS
.TS
allbox;
lb lb lbx lb
l l l l.
Name Type Description Default
text Text The text to be trimmed. -
to_trim Text The characters to remove from the left/right of the text. "\ $\[rs]t\[rs]r\[rs]n"
left Bool Whether or not to trim from the front of the text. yes
right Bool Whether or not to trim from the back of the text. yes
.TE
.SH RETURN
The text without the trim characters at either end.
.SH EXAMPLES
.EX
>> " x y z \[rs]n".trim()
= "x y z"
>> "one,".trim(",")
= "one"
>> " xyz ".trim(right=no)
= "xyz "
.EE
|