File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -122,16 +122,30 @@ var Functions = []*Function{
122
122
{
123
123
Name : "trimPrefix" ,
124
124
Func : func (args ... interface {}) (interface {}, error ) {
125
- return strings .TrimPrefix (args [0 ].(string ), args [1 ].(string )), nil
125
+ s := " "
126
+ if len (args ) == 2 {
127
+ s = args [1 ].(string )
128
+ }
129
+ return strings .TrimPrefix (args [0 ].(string ), s ), nil
126
130
},
127
- Types : types (strings .TrimPrefix ),
131
+ Types : types (
132
+ strings .TrimPrefix ,
133
+ new (func (string ) string ),
134
+ ),
128
135
},
129
136
{
130
137
Name : "trimSuffix" ,
131
138
Func : func (args ... interface {}) (interface {}, error ) {
132
- return strings .TrimSuffix (args [0 ].(string ), args [1 ].(string )), nil
139
+ s := " "
140
+ if len (args ) == 2 {
141
+ s = args [1 ].(string )
142
+ }
143
+ return strings .TrimSuffix (args [0 ].(string ), s ), nil
133
144
},
134
- Types : types (strings .TrimSuffix ),
145
+ Types : types (
146
+ strings .TrimSuffix ,
147
+ new (func (string ) string ),
148
+ ),
135
149
},
136
150
{
137
151
Name : "upper" ,
You can’t perform that action at this time.
0 commit comments