line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Venus::String; |
2
|
|
|
|
|
|
|
|
3
|
20
|
|
|
20
|
|
494
|
use 5.018; |
|
20
|
|
|
|
|
87
|
|
4
|
|
|
|
|
|
|
|
5
|
20
|
|
|
20
|
|
125
|
use strict; |
|
20
|
|
|
|
|
41
|
|
|
20
|
|
|
|
|
478
|
|
6
|
20
|
|
|
20
|
|
97
|
use warnings; |
|
20
|
|
|
|
|
47
|
|
|
20
|
|
|
|
|
614
|
|
7
|
|
|
|
|
|
|
|
8
|
20
|
|
|
20
|
|
135
|
use Venus::Class 'base'; |
|
20
|
|
|
|
|
51
|
|
|
20
|
|
|
|
|
166
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
base 'Venus::Kind::Value'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use overload ( |
13
|
23
|
|
|
23
|
|
1220
|
'eq' => sub{$_[0]->value eq "$_[1]"}, |
14
|
2
|
|
|
2
|
|
10
|
'ne' => sub{$_[0]->value ne "$_[1]"}, |
15
|
1
|
|
|
1
|
|
3
|
'qr' => sub{qr/@{[quotemeta($_[0]->value)]}/}, |
|
1
|
|
|
|
|
6
|
|
16
|
20
|
|
|
|
|
300
|
fallback => 1, |
17
|
20
|
|
|
20
|
|
155
|
); |
|
20
|
|
|
|
|
54
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# METHODS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub append { |
22
|
1
|
|
|
1
|
1
|
7
|
my ($self, @args) = @_; |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
5
|
return $self->append_with(' ', @args); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub append_with { |
28
|
2
|
|
|
2
|
1
|
9
|
my ($self, $delimiter, @args) = @_; |
29
|
|
|
|
|
|
|
|
30
|
2
|
|
|
|
|
6
|
my $data = $self->get; |
31
|
|
|
|
|
|
|
|
32
|
2
|
|
50
|
|
|
22
|
return CORE::join($delimiter // '', $data, @args); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub assertion { |
36
|
88
|
|
|
88
|
1
|
166
|
my ($self) = @_; |
37
|
|
|
|
|
|
|
|
38
|
88
|
|
|
|
|
270
|
my $assert = $self->SUPER::assertion; |
39
|
|
|
|
|
|
|
|
40
|
88
|
|
|
|
|
219
|
$assert->clear->expression('string | number | float | boolean'); |
41
|
|
|
|
|
|
|
|
42
|
88
|
|
|
|
|
334
|
return $assert; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub camelcase { |
46
|
1
|
|
|
1
|
1
|
3
|
my ($self) = @_; |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
3
|
my $data = $self->get; |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
7
|
my $result = CORE::ucfirst(CORE::lc($data)); |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
12
|
$result =~ s/[^a-zA-Z0-9]+([a-z])/\U$1/g; |
53
|
1
|
|
|
|
|
3
|
$result =~ s/[^a-zA-Z0-9]+//g; |
54
|
|
|
|
|
|
|
|
55
|
1
|
|
|
|
|
8
|
return CORE::lcfirst($result); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub chomp { |
59
|
2
|
|
|
2
|
1
|
5
|
my ($self) = @_; |
60
|
|
|
|
|
|
|
|
61
|
2
|
|
|
|
|
7
|
my $data = $self->get; |
62
|
|
|
|
|
|
|
|
63
|
2
|
|
|
|
|
7
|
CORE::chomp($data); |
64
|
|
|
|
|
|
|
|
65
|
2
|
|
|
|
|
10
|
return $data; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub chop { |
69
|
1
|
|
|
1
|
1
|
3
|
my ($self) = @_; |
70
|
|
|
|
|
|
|
|
71
|
1
|
|
|
|
|
4
|
my $data = $self->get; |
72
|
|
|
|
|
|
|
|
73
|
1
|
|
|
|
|
3
|
CORE::chop($data); |
74
|
|
|
|
|
|
|
|
75
|
1
|
|
|
|
|
5
|
return $data; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub comparer { |
79
|
270
|
|
|
270
|
0
|
575
|
my ($self) = @_; |
80
|
|
|
|
|
|
|
|
81
|
270
|
|
|
|
|
679
|
my $data = $self->get; |
82
|
|
|
|
|
|
|
|
83
|
270
|
|
|
|
|
1286
|
require Scalar::Util; |
84
|
|
|
|
|
|
|
|
85
|
270
|
100
|
|
|
|
1910
|
return Scalar::Util::looks_like_number($data) ? 'numified' : 'stringified'; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub concat { |
89
|
1
|
|
|
1
|
1
|
5
|
my ($self, @args) = @_; |
90
|
|
|
|
|
|
|
|
91
|
1
|
|
|
|
|
4
|
my $data = $self->get; |
92
|
|
|
|
|
|
|
|
93
|
1
|
|
|
|
|
12
|
return CORE::join('', $data, @args); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub contains { |
97
|
3
|
|
|
3
|
1
|
9
|
my ($self, $pattern) = @_; |
98
|
|
|
|
|
|
|
|
99
|
3
|
|
|
|
|
8
|
my $data = $self->get; |
100
|
|
|
|
|
|
|
|
101
|
3
|
50
|
|
|
|
11
|
return 0 unless CORE::defined($pattern); |
102
|
|
|
|
|
|
|
|
103
|
3
|
|
|
|
|
17
|
my $regexp = UNIVERSAL::isa($pattern, 'Regexp'); |
104
|
|
|
|
|
|
|
|
105
|
3
|
100
|
|
|
|
20
|
return CORE::index($data, $pattern) < 0 ? 0 : 1 if !$regexp; |
|
|
100
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
1
|
50
|
|
|
|
10
|
return ($data =~ $pattern) ? true : false; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub default { |
111
|
182
|
|
|
182
|
1
|
698
|
return ''; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub format { |
115
|
2
|
|
|
2
|
1
|
6
|
my ($self, @args) = @_; |
116
|
|
|
|
|
|
|
|
117
|
2
|
|
|
|
|
10
|
my $data = $self->get; |
118
|
|
|
|
|
|
|
|
119
|
2
|
|
|
|
|
16
|
return CORE::sprintf($data, @args); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub hex { |
123
|
1
|
|
|
1
|
1
|
5
|
my ($self) = @_; |
124
|
|
|
|
|
|
|
|
125
|
1
|
|
|
|
|
4
|
my $data = $self->get; |
126
|
|
|
|
|
|
|
|
127
|
1
|
|
|
|
|
7
|
return CORE::hex($data); |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub index { |
131
|
3
|
|
|
3
|
1
|
11
|
my ($self, $substr, $start) = @_; |
132
|
|
|
|
|
|
|
|
133
|
3
|
|
|
|
|
13
|
my $data = $self->get; |
134
|
|
|
|
|
|
|
|
135
|
3
|
100
|
|
|
|
21
|
return CORE::index($data, $substr) if not(CORE::defined($start)); |
136
|
1
|
|
|
|
|
15
|
return CORE::index($data, $substr, $start); |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
sub kebabcase { |
140
|
1
|
|
|
1
|
1
|
5
|
my ($self) = @_; |
141
|
|
|
|
|
|
|
|
142
|
1
|
|
|
|
|
5
|
my $data = $self->get; |
143
|
1
|
|
|
|
|
5
|
my $re = qr/[\W_]+/; |
144
|
|
|
|
|
|
|
|
145
|
1
|
|
|
|
|
9
|
$data =~ s/$re/-/g; |
146
|
1
|
|
|
|
|
104
|
$data =~ s/^$re|$re$//g; |
147
|
|
|
|
|
|
|
|
148
|
1
|
|
|
|
|
11
|
return $data; |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub lc { |
152
|
1
|
|
|
1
|
1
|
6
|
my ($self) = @_; |
153
|
|
|
|
|
|
|
|
154
|
1
|
|
|
|
|
6
|
my $data = $self->get; |
155
|
|
|
|
|
|
|
|
156
|
1
|
|
|
|
|
7
|
return CORE::lc($data); |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
sub lcfirst { |
160
|
1
|
|
|
1
|
1
|
5
|
my ($self) = @_; |
161
|
|
|
|
|
|
|
|
162
|
1
|
|
|
|
|
5
|
my $data = $self->get; |
163
|
|
|
|
|
|
|
|
164
|
1
|
|
|
|
|
15
|
return CORE::lcfirst($data); |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub length { |
168
|
1
|
|
|
1
|
1
|
8
|
my ($self) = @_; |
169
|
|
|
|
|
|
|
|
170
|
1
|
|
|
|
|
8
|
my $data = $self->get; |
171
|
|
|
|
|
|
|
|
172
|
1
|
|
|
|
|
13
|
return CORE::length($data); |
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
sub lines { |
176
|
2
|
|
|
2
|
1
|
7
|
my ($self) = @_; |
177
|
|
|
|
|
|
|
|
178
|
2
|
|
|
|
|
6
|
my $data = $self->get; |
179
|
|
|
|
|
|
|
|
180
|
2
|
|
|
|
|
19
|
return [CORE::split(/[\n\r]+/, $data)]; |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
sub lowercase { |
184
|
1
|
|
|
1
|
1
|
6
|
my ($self) = @_; |
185
|
|
|
|
|
|
|
|
186
|
1
|
|
|
|
|
5
|
my $data = $self->get; |
187
|
|
|
|
|
|
|
|
188
|
1
|
|
|
|
|
7
|
return CORE::lc($data); |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
sub numified { |
192
|
76
|
|
|
76
|
1
|
247
|
my ($self) = @_; |
193
|
|
|
|
|
|
|
|
194
|
76
|
|
|
|
|
262
|
my $data = $self->get; |
195
|
|
|
|
|
|
|
|
196
|
76
|
100
|
|
|
|
455
|
return $self->comparer eq 'numified' ? (0 + $data) : $self->SUPER::numified(); |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
sub pascalcase { |
200
|
1
|
|
|
1
|
1
|
3
|
my ($self) = @_; |
201
|
|
|
|
|
|
|
|
202
|
1
|
|
|
|
|
5
|
my $data = $self->get; |
203
|
|
|
|
|
|
|
|
204
|
1
|
|
|
|
|
10
|
my $result = CORE::ucfirst(CORE::lc($data)); |
205
|
|
|
|
|
|
|
|
206
|
1
|
|
|
|
|
11
|
$result =~ s/[^a-zA-Z0-9]+([a-z])/\U$1/g; |
207
|
1
|
|
|
|
|
4
|
$result =~ s/[^a-zA-Z0-9]+//g; |
208
|
|
|
|
|
|
|
|
209
|
1
|
|
|
|
|
6
|
return $result; |
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
sub prepend { |
213
|
1
|
|
|
1
|
1
|
9
|
my ($self, @args) = @_; |
214
|
|
|
|
|
|
|
|
215
|
1
|
|
|
|
|
6
|
return $self->prepend_with(' ', @args); |
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
sub prepend_with { |
219
|
2
|
|
|
2
|
1
|
8
|
my ($self, $delimiter, @args) = @_; |
220
|
|
|
|
|
|
|
|
221
|
2
|
|
|
|
|
7
|
my $data = $self->get; |
222
|
|
|
|
|
|
|
|
223
|
2
|
|
50
|
|
|
22
|
return CORE::join($delimiter // '', @args, $data); |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub repeat { |
227
|
2
|
|
|
2
|
1
|
8
|
my ($self, $count, $delimiter) = @_; |
228
|
|
|
|
|
|
|
|
229
|
2
|
|
|
|
|
7
|
my $data = $self->get; |
230
|
|
|
|
|
|
|
|
231
|
2
|
|
100
|
|
|
25
|
return CORE::join($delimiter // '', CORE::map $data, 1..($count || 1)); |
|
|
|
50
|
|
|
|
|
232
|
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
sub render { |
235
|
1
|
|
|
1
|
1
|
6
|
my ($self, $tokens) = @_; |
236
|
|
|
|
|
|
|
|
237
|
1
|
|
|
|
|
5
|
my $data = $self->get; |
238
|
|
|
|
|
|
|
|
239
|
1
|
|
50
|
|
|
11
|
$tokens ||= {}; |
240
|
|
|
|
|
|
|
|
241
|
1
|
|
|
|
|
14
|
while (my($key, $value) = each(%$tokens)) { |
242
|
1
|
|
|
|
|
5
|
my $token = quotemeta $key; |
243
|
1
|
|
|
|
|
34
|
$data =~ s/\{\{\s*$token\s*\}\}/$value/g; |
244
|
|
|
|
|
|
|
} |
245
|
|
|
|
|
|
|
|
246
|
1
|
|
|
|
|
9
|
return $data; |
247
|
|
|
|
|
|
|
} |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
sub replace { |
250
|
1
|
|
|
1
|
1
|
5
|
my ($self, $regexp, $replace, $flags) = @_; |
251
|
|
|
|
|
|
|
|
252
|
1
|
|
|
|
|
5
|
require Venus::Regexp; |
253
|
|
|
|
|
|
|
|
254
|
1
|
|
|
|
|
6
|
return Venus::Regexp->new($regexp)->replace($self->get, $replace, $flags); |
255
|
|
|
|
|
|
|
} |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
sub reverse { |
258
|
1
|
|
|
1
|
1
|
3
|
my ($self) = @_; |
259
|
|
|
|
|
|
|
|
260
|
1
|
|
|
|
|
6
|
my $data = $self->get; |
261
|
|
|
|
|
|
|
|
262
|
1
|
|
|
|
|
7
|
return scalar(CORE::reverse($data)); |
263
|
|
|
|
|
|
|
} |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
sub rindex { |
266
|
3
|
|
|
3
|
1
|
11
|
my ($self, $substr, $start) = @_; |
267
|
|
|
|
|
|
|
|
268
|
3
|
|
|
|
|
8
|
my $data = $self->get; |
269
|
|
|
|
|
|
|
|
270
|
3
|
100
|
|
|
|
15
|
return CORE::rindex($data, $substr) if not(CORE::defined($start)); |
271
|
1
|
|
|
|
|
8
|
return CORE::rindex($data, $substr, $start); |
272
|
|
|
|
|
|
|
} |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
sub search { |
275
|
1
|
|
|
1
|
1
|
4
|
my ($self, $regexp) = @_; |
276
|
|
|
|
|
|
|
|
277
|
1
|
|
|
|
|
6
|
require Venus::Regexp; |
278
|
|
|
|
|
|
|
|
279
|
1
|
|
|
|
|
9
|
return Venus::Regexp->new($regexp)->search($self->get); |
280
|
|
|
|
|
|
|
} |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
sub snakecase { |
283
|
1
|
|
|
1
|
1
|
5
|
my ($self) = @_; |
284
|
|
|
|
|
|
|
|
285
|
1
|
|
|
|
|
4
|
my $data = $self->get; |
286
|
1
|
|
|
|
|
12
|
my $re = qr/[\W_]+/; |
287
|
|
|
|
|
|
|
|
288
|
1
|
|
|
|
|
8
|
$data =~ s/$re/_/g; |
289
|
1
|
|
|
|
|
84
|
$data =~ s/^$re|$re$//g; |
290
|
|
|
|
|
|
|
|
291
|
1
|
|
|
|
|
10
|
return $data; |
292
|
|
|
|
|
|
|
} |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
sub split { |
295
|
3
|
|
|
3
|
1
|
11
|
my ($self, $pattern, $limit) = @_; |
296
|
|
|
|
|
|
|
|
297
|
3
|
|
|
|
|
9
|
my $data = $self->get; |
298
|
|
|
|
|
|
|
|
299
|
3
|
|
50
|
|
|
13
|
$pattern //= ''; |
300
|
|
|
|
|
|
|
|
301
|
3
|
|
|
|
|
14
|
my $regexp = UNIVERSAL::isa($pattern, 'Regexp'); |
302
|
|
|
|
|
|
|
|
303
|
3
|
100
|
66
|
|
|
19
|
$pattern = quotemeta($pattern) if $pattern and !$regexp; |
304
|
|
|
|
|
|
|
|
305
|
3
|
100
|
|
|
|
38
|
return [CORE::split(/$pattern/, $data)] if !CORE::defined($limit); |
306
|
1
|
|
|
|
|
26
|
return [CORE::split(/$pattern/, $data, $limit)]; |
307
|
|
|
|
|
|
|
} |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
sub strip { |
310
|
1
|
|
|
1
|
1
|
4
|
my ($self) = @_; |
311
|
|
|
|
|
|
|
|
312
|
1
|
|
|
|
|
5
|
my $data = $self->get; |
313
|
|
|
|
|
|
|
|
314
|
1
|
|
|
|
|
8
|
$data =~ s/\s{2,}/ /g; |
315
|
|
|
|
|
|
|
|
316
|
1
|
|
|
|
|
8
|
return $data; |
317
|
|
|
|
|
|
|
} |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
sub substr { |
320
|
4
|
|
|
4
|
1
|
16
|
my ($self, $offset, $length, $replace) = @_; |
321
|
|
|
|
|
|
|
|
322
|
4
|
|
|
|
|
13
|
my $data = $self->get; |
323
|
|
|
|
|
|
|
|
324
|
4
|
100
|
|
|
|
19
|
if (CORE::defined($replace)) { |
325
|
2
|
|
50
|
|
|
16
|
my $result = CORE::substr($data, $offset // 0, $length // 0, $replace); |
|
|
|
50
|
|
|
|
|
326
|
2
|
100
|
|
|
|
45
|
return wantarray ? ($result, $data) : $data; |
327
|
|
|
|
|
|
|
} |
328
|
|
|
|
|
|
|
else { |
329
|
2
|
|
50
|
|
|
13
|
my $result = CORE::substr($data, $offset // 0, $length // 0); |
|
|
|
50
|
|
|
|
|
330
|
2
|
50
|
|
|
|
16
|
return wantarray ? ($result, $data) : $result; |
331
|
|
|
|
|
|
|
} |
332
|
|
|
|
|
|
|
} |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
sub template { |
335
|
2
|
|
|
2
|
1
|
10
|
my ($self, $code, @args) = @_; |
336
|
|
|
|
|
|
|
|
337
|
2
|
|
|
|
|
1279
|
require Venus::Template; |
338
|
|
|
|
|
|
|
|
339
|
2
|
|
|
|
|
13
|
my $template = Venus::Template->new($self->get); |
340
|
|
|
|
|
|
|
|
341
|
2
|
100
|
|
|
|
20
|
return $code ? $template->$code(@args) : $template; |
342
|
|
|
|
|
|
|
} |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
sub titlecase { |
345
|
1
|
|
|
1
|
1
|
4
|
my ($self) = @_; |
346
|
|
|
|
|
|
|
|
347
|
1
|
|
|
|
|
9
|
my $data = $self->get; |
348
|
|
|
|
|
|
|
|
349
|
1
|
|
|
|
|
19
|
$data =~ s/\b(\w)/\U$1/g; |
350
|
|
|
|
|
|
|
|
351
|
1
|
|
|
|
|
6
|
return $data; |
352
|
|
|
|
|
|
|
} |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
sub trim { |
355
|
1
|
|
|
1
|
1
|
3
|
my ($self) = @_; |
356
|
|
|
|
|
|
|
|
357
|
1
|
|
|
|
|
5
|
my $data = $self->get; |
358
|
|
|
|
|
|
|
|
359
|
1
|
|
|
|
|
10
|
$data =~ s/^\s+|\s+$//g; |
360
|
|
|
|
|
|
|
|
361
|
1
|
|
|
|
|
6
|
return $data; |
362
|
|
|
|
|
|
|
} |
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
sub uc { |
365
|
1
|
|
|
1
|
1
|
5
|
my ($self) = @_; |
366
|
|
|
|
|
|
|
|
367
|
1
|
|
|
|
|
5
|
my $data = $self->get; |
368
|
|
|
|
|
|
|
|
369
|
1
|
|
|
|
|
8
|
return CORE::uc($data); |
370
|
|
|
|
|
|
|
} |
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
sub ucfirst { |
373
|
1
|
|
|
1
|
1
|
6
|
my ($self) = @_; |
374
|
|
|
|
|
|
|
|
375
|
1
|
|
|
|
|
5
|
my $data = $self->get; |
376
|
|
|
|
|
|
|
|
377
|
1
|
|
|
|
|
11
|
return CORE::ucfirst($data); |
378
|
|
|
|
|
|
|
} |
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
sub uppercase { |
381
|
1
|
|
|
1
|
1
|
4
|
my ($self) = @_; |
382
|
|
|
|
|
|
|
|
383
|
1
|
|
|
|
|
5
|
my $data = $self->get; |
384
|
|
|
|
|
|
|
|
385
|
1
|
|
|
|
|
16
|
return CORE::uc($data); |
386
|
|
|
|
|
|
|
} |
387
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
sub words { |
389
|
1
|
|
|
1
|
1
|
4
|
my ($self) = @_; |
390
|
|
|
|
|
|
|
|
391
|
1
|
|
|
|
|
6
|
my $data = $self->get; |
392
|
|
|
|
|
|
|
|
393
|
1
|
|
|
|
|
13
|
return [CORE::split(/\s+/, $data)]; |
394
|
|
|
|
|
|
|
} |
395
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
1; |
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
=head1 NAME |
401
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
Venus::String - String Class |
403
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
=cut |
405
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
=head1 ABSTRACT |
407
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
String Class for Perl 5 |
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
=cut |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
=head1 SYNOPSIS |
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
package main; |
415
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
use Venus::String; |
417
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
my $string = Venus::String->new('hello world'); |
419
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
# $string->camelcase; |
421
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
=cut |
423
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
=head1 DESCRIPTION |
425
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
This package provides methods for manipulating string data. |
427
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
=cut |
429
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
=head1 INHERITS |
431
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
This package inherits behaviors from: |
433
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
L |
435
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
=cut |
437
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
=head1 METHODS |
439
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
This package provides the following methods: |
441
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
=cut |
443
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
=head2 append |
445
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
append(Str @parts) (Str) |
447
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
The append method appends arugments to the string using spaces. |
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
I> |
451
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
=over 4 |
453
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
=item append example 1 |
455
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
# given: synopsis; |
457
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
my $append = $string->append('welcome'); |
459
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
# "hello world welcome" |
461
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
=back |
463
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
=cut |
465
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
=head2 append_with |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
append_with(Str $delimiter, Str @parts) (Str) |
469
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
The append_with method appends arugments to the string using the delimiter |
471
|
|
|
|
|
|
|
provided. |
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
I> |
474
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
=over 4 |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
=item append_with example 1 |
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
# given: synopsis; |
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
my $append = $string->append_with(', ', 'welcome'); |
482
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
# "hello world, welcome" |
484
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
=back |
486
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
=cut |
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
=head2 camelcase |
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
camelcase() (Str) |
492
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
The camelcase method converts the string to camelcase. |
494
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
I> |
496
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
=over 4 |
498
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
=item camelcase example 1 |
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
# given: synopsis; |
502
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
my $camelcase = $string->camelcase; |
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
# "helloWorld" |
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
=back |
508
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
=cut |
510
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
=head2 cast |
512
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
cast(Str $kind) (Object | Undef) |
514
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
The cast method converts L<"value"|Venus::Kind::Value> objects between |
516
|
|
|
|
|
|
|
different I<"value"> object types, based on the name of the type provided. This |
517
|
|
|
|
|
|
|
method will return C if the invocant is not a L. |
518
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
I> |
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
=over 4 |
522
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
=item cast example 1 |
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
package main; |
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
use Venus::String; |
528
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
my $string = Venus::String->new; |
530
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
my $cast = $string->cast('array'); |
532
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
# bless({ value => [""] }, "Venus::Array") |
534
|
|
|
|
|
|
|
|
535
|
|
|
|
|
|
|
=back |
536
|
|
|
|
|
|
|
|
537
|
|
|
|
|
|
|
=over 4 |
538
|
|
|
|
|
|
|
|
539
|
|
|
|
|
|
|
=item cast example 2 |
540
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
package main; |
542
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
use Venus::String; |
544
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
my $string = Venus::String->new; |
546
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
my $cast = $string->cast('boolean'); |
548
|
|
|
|
|
|
|
|
549
|
|
|
|
|
|
|
# bless({ value => 0 }, "Venus::Boolean") |
550
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
=back |
552
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
=over 4 |
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
=item cast example 3 |
556
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
package main; |
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
use Venus::String; |
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
my $string = Venus::String->new; |
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
my $cast = $string->cast('code'); |
564
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
# bless({ value => sub { ... } }, "Venus::Code") |
566
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
=back |
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
=over 4 |
570
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
=item cast example 4 |
572
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
package main; |
574
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
use Venus::String; |
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
my $string = Venus::String->new; |
578
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
my $cast = $string->cast('float'); |
580
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
# bless({ value => "0.0" }, "Venus::Float") |
582
|
|
|
|
|
|
|
|
583
|
|
|
|
|
|
|
=back |
584
|
|
|
|
|
|
|
|
585
|
|
|
|
|
|
|
=over 4 |
586
|
|
|
|
|
|
|
|
587
|
|
|
|
|
|
|
=item cast example 5 |
588
|
|
|
|
|
|
|
|
589
|
|
|
|
|
|
|
package main; |
590
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
use Venus::String; |
592
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
my $string = Venus::String->new; |
594
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
my $cast = $string->cast('hash'); |
596
|
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
# bless({ value => { "" => "" } }, "Venus::Hash") |
598
|
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
=back |
600
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
=over 4 |
602
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
=item cast example 6 |
604
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
package main; |
606
|
|
|
|
|
|
|
|
607
|
|
|
|
|
|
|
use Venus::String; |
608
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
my $string = Venus::String->new; |
610
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
my $cast = $string->cast('number'); |
612
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
# bless({ value => 0 }, "Venus::Float") |
614
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
=back |
616
|
|
|
|
|
|
|
|
617
|
|
|
|
|
|
|
=over 4 |
618
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
=item cast example 7 |
620
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
package main; |
622
|
|
|
|
|
|
|
|
623
|
|
|
|
|
|
|
use Venus::String; |
624
|
|
|
|
|
|
|
|
625
|
|
|
|
|
|
|
my $string = Venus::String->new; |
626
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
my $cast = $string->cast('regexp'); |
628
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
# bless({ value => qr/(?^u:)/ }, "Venus::Regexp") |
630
|
|
|
|
|
|
|
|
631
|
|
|
|
|
|
|
=back |
632
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
=over 4 |
634
|
|
|
|
|
|
|
|
635
|
|
|
|
|
|
|
=item cast example 8 |
636
|
|
|
|
|
|
|
|
637
|
|
|
|
|
|
|
package main; |
638
|
|
|
|
|
|
|
|
639
|
|
|
|
|
|
|
use Venus::String; |
640
|
|
|
|
|
|
|
|
641
|
|
|
|
|
|
|
my $string = Venus::String->new; |
642
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
my $cast = $string->cast('scalar'); |
644
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
# bless({ value => \"" }, "Venus::Scalar") |
646
|
|
|
|
|
|
|
|
647
|
|
|
|
|
|
|
=back |
648
|
|
|
|
|
|
|
|
649
|
|
|
|
|
|
|
=over 4 |
650
|
|
|
|
|
|
|
|
651
|
|
|
|
|
|
|
=item cast example 9 |
652
|
|
|
|
|
|
|
|
653
|
|
|
|
|
|
|
package main; |
654
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
use Venus::String; |
656
|
|
|
|
|
|
|
|
657
|
|
|
|
|
|
|
my $string = Venus::String->new; |
658
|
|
|
|
|
|
|
|
659
|
|
|
|
|
|
|
my $cast = $string->cast('string'); |
660
|
|
|
|
|
|
|
|
661
|
|
|
|
|
|
|
# bless({ value => "" }, "Venus::String") |
662
|
|
|
|
|
|
|
|
663
|
|
|
|
|
|
|
=back |
664
|
|
|
|
|
|
|
|
665
|
|
|
|
|
|
|
=over 4 |
666
|
|
|
|
|
|
|
|
667
|
|
|
|
|
|
|
=item cast example 10 |
668
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
package main; |
670
|
|
|
|
|
|
|
|
671
|
|
|
|
|
|
|
use Venus::String; |
672
|
|
|
|
|
|
|
|
673
|
|
|
|
|
|
|
my $string = Venus::String->new; |
674
|
|
|
|
|
|
|
|
675
|
|
|
|
|
|
|
my $cast = $string->cast('undef'); |
676
|
|
|
|
|
|
|
|
677
|
|
|
|
|
|
|
# bless({ value => undef }, "Venus::Undef") |
678
|
|
|
|
|
|
|
|
679
|
|
|
|
|
|
|
=back |
680
|
|
|
|
|
|
|
|
681
|
|
|
|
|
|
|
=cut |
682
|
|
|
|
|
|
|
|
683
|
|
|
|
|
|
|
=head2 chomp |
684
|
|
|
|
|
|
|
|
685
|
|
|
|
|
|
|
chomp() (Str) |
686
|
|
|
|
|
|
|
|
687
|
|
|
|
|
|
|
The chomp method removes the newline (or the current value of $/) from the end |
688
|
|
|
|
|
|
|
of the string. |
689
|
|
|
|
|
|
|
|
690
|
|
|
|
|
|
|
I> |
691
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
=over 4 |
693
|
|
|
|
|
|
|
|
694
|
|
|
|
|
|
|
=item chomp example 1 |
695
|
|
|
|
|
|
|
|
696
|
|
|
|
|
|
|
package main; |
697
|
|
|
|
|
|
|
|
698
|
|
|
|
|
|
|
use Venus::String; |
699
|
|
|
|
|
|
|
|
700
|
|
|
|
|
|
|
my $string = Venus::String->new("name, age, dob, email\n"); |
701
|
|
|
|
|
|
|
|
702
|
|
|
|
|
|
|
my $chomp = $string->chomp; |
703
|
|
|
|
|
|
|
|
704
|
|
|
|
|
|
|
# "name, age, dob, email" |
705
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
=back |
707
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
=over 4 |
709
|
|
|
|
|
|
|
|
710
|
|
|
|
|
|
|
=item chomp example 2 |
711
|
|
|
|
|
|
|
|
712
|
|
|
|
|
|
|
package main; |
713
|
|
|
|
|
|
|
|
714
|
|
|
|
|
|
|
use Venus::String; |
715
|
|
|
|
|
|
|
|
716
|
|
|
|
|
|
|
my $string = Venus::String->new("name, age, dob, email\n\n"); |
717
|
|
|
|
|
|
|
|
718
|
|
|
|
|
|
|
my $chomp = $string->chomp; |
719
|
|
|
|
|
|
|
|
720
|
|
|
|
|
|
|
# "name, age, dob, email\n" |
721
|
|
|
|
|
|
|
|
722
|
|
|
|
|
|
|
=back |
723
|
|
|
|
|
|
|
|
724
|
|
|
|
|
|
|
=cut |
725
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
=head2 chop |
727
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
chop() (Str) |
729
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
The chop method removes and returns the last character of the string. |
731
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
I> |
733
|
|
|
|
|
|
|
|
734
|
|
|
|
|
|
|
=over 4 |
735
|
|
|
|
|
|
|
|
736
|
|
|
|
|
|
|
=item chop example 1 |
737
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
package main; |
739
|
|
|
|
|
|
|
|
740
|
|
|
|
|
|
|
use Venus::String; |
741
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
my $string = Venus::String->new("this is just a test."); |
743
|
|
|
|
|
|
|
|
744
|
|
|
|
|
|
|
my $chop = $string->chop; |
745
|
|
|
|
|
|
|
|
746
|
|
|
|
|
|
|
# "this is just a test" |
747
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
=back |
749
|
|
|
|
|
|
|
|
750
|
|
|
|
|
|
|
=cut |
751
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
=head2 concat |
753
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
concat(Str @parts) (Str) |
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
The concat method returns the string with the argument list appended to it. |
757
|
|
|
|
|
|
|
|
758
|
|
|
|
|
|
|
I> |
759
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
=over 4 |
761
|
|
|
|
|
|
|
|
762
|
|
|
|
|
|
|
=item concat example 1 |
763
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
package main; |
765
|
|
|
|
|
|
|
|
766
|
|
|
|
|
|
|
use Venus::String; |
767
|
|
|
|
|
|
|
|
768
|
|
|
|
|
|
|
my $string = Venus::String->new('ABC'); |
769
|
|
|
|
|
|
|
|
770
|
|
|
|
|
|
|
my $concat = $string->concat('DEF', 'GHI'); |
771
|
|
|
|
|
|
|
|
772
|
|
|
|
|
|
|
# "ABCDEFGHI" |
773
|
|
|
|
|
|
|
|
774
|
|
|
|
|
|
|
=back |
775
|
|
|
|
|
|
|
|
776
|
|
|
|
|
|
|
=cut |
777
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
=head2 contains |
779
|
|
|
|
|
|
|
|
780
|
|
|
|
|
|
|
contains(Str $expr) (Bool) |
781
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
The contains method searches the string for a substring or expression returns |
783
|
|
|
|
|
|
|
true or false if found. |
784
|
|
|
|
|
|
|
|
785
|
|
|
|
|
|
|
I> |
786
|
|
|
|
|
|
|
|
787
|
|
|
|
|
|
|
=over 4 |
788
|
|
|
|
|
|
|
|
789
|
|
|
|
|
|
|
=item contains example 1 |
790
|
|
|
|
|
|
|
|
791
|
|
|
|
|
|
|
package main; |
792
|
|
|
|
|
|
|
|
793
|
|
|
|
|
|
|
use Venus::String; |
794
|
|
|
|
|
|
|
|
795
|
|
|
|
|
|
|
my $string = Venus::String->new('Nullam ultrices placerat.'); |
796
|
|
|
|
|
|
|
|
797
|
|
|
|
|
|
|
my $contains = $string->contains('trices'); |
798
|
|
|
|
|
|
|
|
799
|
|
|
|
|
|
|
# 1 |
800
|
|
|
|
|
|
|
|
801
|
|
|
|
|
|
|
=back |
802
|
|
|
|
|
|
|
|
803
|
|
|
|
|
|
|
=over 4 |
804
|
|
|
|
|
|
|
|
805
|
|
|
|
|
|
|
=item contains example 2 |
806
|
|
|
|
|
|
|
|
807
|
|
|
|
|
|
|
package main; |
808
|
|
|
|
|
|
|
|
809
|
|
|
|
|
|
|
use Venus::String; |
810
|
|
|
|
|
|
|
|
811
|
|
|
|
|
|
|
my $string = Venus::String->new('Nullam ultrices placerat.'); |
812
|
|
|
|
|
|
|
|
813
|
|
|
|
|
|
|
my $contains = $string->contains('itrices'); |
814
|
|
|
|
|
|
|
|
815
|
|
|
|
|
|
|
# 0 |
816
|
|
|
|
|
|
|
|
817
|
|
|
|
|
|
|
=back |
818
|
|
|
|
|
|
|
|
819
|
|
|
|
|
|
|
=over 4 |
820
|
|
|
|
|
|
|
|
821
|
|
|
|
|
|
|
=item contains example 3 |
822
|
|
|
|
|
|
|
|
823
|
|
|
|
|
|
|
package main; |
824
|
|
|
|
|
|
|
|
825
|
|
|
|
|
|
|
use Venus::String; |
826
|
|
|
|
|
|
|
|
827
|
|
|
|
|
|
|
my $string = Venus::String->new('Nullam ultrices placerat.'); |
828
|
|
|
|
|
|
|
|
829
|
|
|
|
|
|
|
my $contains = $string->contains(qr/trices/); |
830
|
|
|
|
|
|
|
|
831
|
|
|
|
|
|
|
# 1 |
832
|
|
|
|
|
|
|
|
833
|
|
|
|
|
|
|
=back |
834
|
|
|
|
|
|
|
|
835
|
|
|
|
|
|
|
=cut |
836
|
|
|
|
|
|
|
|
837
|
|
|
|
|
|
|
=head2 default |
838
|
|
|
|
|
|
|
|
839
|
|
|
|
|
|
|
default() (Str) |
840
|
|
|
|
|
|
|
|
841
|
|
|
|
|
|
|
The default method returns the default value, i.e. C<''>. |
842
|
|
|
|
|
|
|
|
843
|
|
|
|
|
|
|
I> |
844
|
|
|
|
|
|
|
|
845
|
|
|
|
|
|
|
=over 4 |
846
|
|
|
|
|
|
|
|
847
|
|
|
|
|
|
|
=item default example 1 |
848
|
|
|
|
|
|
|
|
849
|
|
|
|
|
|
|
# given: synopsis; |
850
|
|
|
|
|
|
|
|
851
|
|
|
|
|
|
|
my $default = $string->default; |
852
|
|
|
|
|
|
|
|
853
|
|
|
|
|
|
|
# "" |
854
|
|
|
|
|
|
|
|
855
|
|
|
|
|
|
|
=back |
856
|
|
|
|
|
|
|
|
857
|
|
|
|
|
|
|
=cut |
858
|
|
|
|
|
|
|
|
859
|
|
|
|
|
|
|
=head2 eq |
860
|
|
|
|
|
|
|
|
861
|
|
|
|
|
|
|
eq(Any $arg) (Bool) |
862
|
|
|
|
|
|
|
|
863
|
|
|
|
|
|
|
The eq method performs an I<"equals"> operation using the argument provided. |
864
|
|
|
|
|
|
|
|
865
|
|
|
|
|
|
|
I> |
866
|
|
|
|
|
|
|
|
867
|
|
|
|
|
|
|
=over 4 |
868
|
|
|
|
|
|
|
|
869
|
|
|
|
|
|
|
=item eq example 1 |
870
|
|
|
|
|
|
|
|
871
|
|
|
|
|
|
|
package main; |
872
|
|
|
|
|
|
|
|
873
|
|
|
|
|
|
|
use Venus::Array; |
874
|
|
|
|
|
|
|
use Venus::String; |
875
|
|
|
|
|
|
|
|
876
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
877
|
|
|
|
|
|
|
my $rvalue = Venus::Array->new; |
878
|
|
|
|
|
|
|
|
879
|
|
|
|
|
|
|
my $result = $lvalue->eq($rvalue); |
880
|
|
|
|
|
|
|
|
881
|
|
|
|
|
|
|
# 0 |
882
|
|
|
|
|
|
|
|
883
|
|
|
|
|
|
|
=back |
884
|
|
|
|
|
|
|
|
885
|
|
|
|
|
|
|
=over 4 |
886
|
|
|
|
|
|
|
|
887
|
|
|
|
|
|
|
=item eq example 2 |
888
|
|
|
|
|
|
|
|
889
|
|
|
|
|
|
|
package main; |
890
|
|
|
|
|
|
|
|
891
|
|
|
|
|
|
|
use Venus::Code; |
892
|
|
|
|
|
|
|
use Venus::String; |
893
|
|
|
|
|
|
|
|
894
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
895
|
|
|
|
|
|
|
my $rvalue = Venus::Code->new; |
896
|
|
|
|
|
|
|
|
897
|
|
|
|
|
|
|
my $result = $lvalue->eq($rvalue); |
898
|
|
|
|
|
|
|
|
899
|
|
|
|
|
|
|
# 0 |
900
|
|
|
|
|
|
|
|
901
|
|
|
|
|
|
|
=back |
902
|
|
|
|
|
|
|
|
903
|
|
|
|
|
|
|
=over 4 |
904
|
|
|
|
|
|
|
|
905
|
|
|
|
|
|
|
=item eq example 3 |
906
|
|
|
|
|
|
|
|
907
|
|
|
|
|
|
|
package main; |
908
|
|
|
|
|
|
|
|
909
|
|
|
|
|
|
|
use Venus::Float; |
910
|
|
|
|
|
|
|
use Venus::String; |
911
|
|
|
|
|
|
|
|
912
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
913
|
|
|
|
|
|
|
my $rvalue = Venus::Float->new; |
914
|
|
|
|
|
|
|
|
915
|
|
|
|
|
|
|
my $result = $lvalue->eq($rvalue); |
916
|
|
|
|
|
|
|
|
917
|
|
|
|
|
|
|
# 0 |
918
|
|
|
|
|
|
|
|
919
|
|
|
|
|
|
|
=back |
920
|
|
|
|
|
|
|
|
921
|
|
|
|
|
|
|
=over 4 |
922
|
|
|
|
|
|
|
|
923
|
|
|
|
|
|
|
=item eq example 4 |
924
|
|
|
|
|
|
|
|
925
|
|
|
|
|
|
|
package main; |
926
|
|
|
|
|
|
|
|
927
|
|
|
|
|
|
|
use Venus::Hash; |
928
|
|
|
|
|
|
|
use Venus::String; |
929
|
|
|
|
|
|
|
|
930
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
931
|
|
|
|
|
|
|
my $rvalue = Venus::Hash->new; |
932
|
|
|
|
|
|
|
|
933
|
|
|
|
|
|
|
my $result = $lvalue->eq($rvalue); |
934
|
|
|
|
|
|
|
|
935
|
|
|
|
|
|
|
# 0 |
936
|
|
|
|
|
|
|
|
937
|
|
|
|
|
|
|
=back |
938
|
|
|
|
|
|
|
|
939
|
|
|
|
|
|
|
=over 4 |
940
|
|
|
|
|
|
|
|
941
|
|
|
|
|
|
|
=item eq example 5 |
942
|
|
|
|
|
|
|
|
943
|
|
|
|
|
|
|
package main; |
944
|
|
|
|
|
|
|
|
945
|
|
|
|
|
|
|
use Venus::Number; |
946
|
|
|
|
|
|
|
use Venus::String; |
947
|
|
|
|
|
|
|
|
948
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
949
|
|
|
|
|
|
|
my $rvalue = Venus::Number->new; |
950
|
|
|
|
|
|
|
|
951
|
|
|
|
|
|
|
my $result = $lvalue->eq($rvalue); |
952
|
|
|
|
|
|
|
|
953
|
|
|
|
|
|
|
# 0 |
954
|
|
|
|
|
|
|
|
955
|
|
|
|
|
|
|
=back |
956
|
|
|
|
|
|
|
|
957
|
|
|
|
|
|
|
=over 4 |
958
|
|
|
|
|
|
|
|
959
|
|
|
|
|
|
|
=item eq example 6 |
960
|
|
|
|
|
|
|
|
961
|
|
|
|
|
|
|
package main; |
962
|
|
|
|
|
|
|
|
963
|
|
|
|
|
|
|
use Venus::Regexp; |
964
|
|
|
|
|
|
|
use Venus::String; |
965
|
|
|
|
|
|
|
|
966
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
967
|
|
|
|
|
|
|
my $rvalue = Venus::Regexp->new; |
968
|
|
|
|
|
|
|
|
969
|
|
|
|
|
|
|
my $result = $lvalue->eq($rvalue); |
970
|
|
|
|
|
|
|
|
971
|
|
|
|
|
|
|
# 0 |
972
|
|
|
|
|
|
|
|
973
|
|
|
|
|
|
|
=back |
974
|
|
|
|
|
|
|
|
975
|
|
|
|
|
|
|
=over 4 |
976
|
|
|
|
|
|
|
|
977
|
|
|
|
|
|
|
=item eq example 7 |
978
|
|
|
|
|
|
|
|
979
|
|
|
|
|
|
|
package main; |
980
|
|
|
|
|
|
|
|
981
|
|
|
|
|
|
|
use Venus::Scalar; |
982
|
|
|
|
|
|
|
use Venus::String; |
983
|
|
|
|
|
|
|
|
984
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
985
|
|
|
|
|
|
|
my $rvalue = Venus::Scalar->new; |
986
|
|
|
|
|
|
|
|
987
|
|
|
|
|
|
|
my $result = $lvalue->eq($rvalue); |
988
|
|
|
|
|
|
|
|
989
|
|
|
|
|
|
|
# 0 |
990
|
|
|
|
|
|
|
|
991
|
|
|
|
|
|
|
=back |
992
|
|
|
|
|
|
|
|
993
|
|
|
|
|
|
|
=over 4 |
994
|
|
|
|
|
|
|
|
995
|
|
|
|
|
|
|
=item eq example 8 |
996
|
|
|
|
|
|
|
|
997
|
|
|
|
|
|
|
package main; |
998
|
|
|
|
|
|
|
|
999
|
|
|
|
|
|
|
use Venus::String; |
1000
|
|
|
|
|
|
|
|
1001
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1002
|
|
|
|
|
|
|
my $rvalue = Venus::String->new; |
1003
|
|
|
|
|
|
|
|
1004
|
|
|
|
|
|
|
my $result = $lvalue->eq($rvalue); |
1005
|
|
|
|
|
|
|
|
1006
|
|
|
|
|
|
|
# 1 |
1007
|
|
|
|
|
|
|
|
1008
|
|
|
|
|
|
|
=back |
1009
|
|
|
|
|
|
|
|
1010
|
|
|
|
|
|
|
=over 4 |
1011
|
|
|
|
|
|
|
|
1012
|
|
|
|
|
|
|
=item eq example 9 |
1013
|
|
|
|
|
|
|
|
1014
|
|
|
|
|
|
|
package main; |
1015
|
|
|
|
|
|
|
|
1016
|
|
|
|
|
|
|
use Venus::String; |
1017
|
|
|
|
|
|
|
use Venus::Undef; |
1018
|
|
|
|
|
|
|
|
1019
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1020
|
|
|
|
|
|
|
my $rvalue = Venus::Undef->new; |
1021
|
|
|
|
|
|
|
|
1022
|
|
|
|
|
|
|
my $result = $lvalue->eq($rvalue); |
1023
|
|
|
|
|
|
|
|
1024
|
|
|
|
|
|
|
# 1 |
1025
|
|
|
|
|
|
|
|
1026
|
|
|
|
|
|
|
=back |
1027
|
|
|
|
|
|
|
|
1028
|
|
|
|
|
|
|
=cut |
1029
|
|
|
|
|
|
|
|
1030
|
|
|
|
|
|
|
=head2 format |
1031
|
|
|
|
|
|
|
|
1032
|
|
|
|
|
|
|
format(Any @args) (Str) |
1033
|
|
|
|
|
|
|
|
1034
|
|
|
|
|
|
|
The format method performs a L operation using the underlying |
1035
|
|
|
|
|
|
|
string and arguments provided and returns the result. |
1036
|
|
|
|
|
|
|
|
1037
|
|
|
|
|
|
|
I> |
1038
|
|
|
|
|
|
|
|
1039
|
|
|
|
|
|
|
=over 4 |
1040
|
|
|
|
|
|
|
|
1041
|
|
|
|
|
|
|
=item format example 1 |
1042
|
|
|
|
|
|
|
|
1043
|
|
|
|
|
|
|
package main; |
1044
|
|
|
|
|
|
|
|
1045
|
|
|
|
|
|
|
use Venus::String; |
1046
|
|
|
|
|
|
|
|
1047
|
|
|
|
|
|
|
my $string = Venus::String->new('hello %s'); |
1048
|
|
|
|
|
|
|
|
1049
|
|
|
|
|
|
|
my $format = $string->format('world'); |
1050
|
|
|
|
|
|
|
|
1051
|
|
|
|
|
|
|
# "hello world" |
1052
|
|
|
|
|
|
|
|
1053
|
|
|
|
|
|
|
=back |
1054
|
|
|
|
|
|
|
|
1055
|
|
|
|
|
|
|
=over 4 |
1056
|
|
|
|
|
|
|
|
1057
|
|
|
|
|
|
|
=item format example 2 |
1058
|
|
|
|
|
|
|
|
1059
|
|
|
|
|
|
|
package main; |
1060
|
|
|
|
|
|
|
|
1061
|
|
|
|
|
|
|
use Venus::String; |
1062
|
|
|
|
|
|
|
|
1063
|
|
|
|
|
|
|
my $string = Venus::String->new('id number %08d'); |
1064
|
|
|
|
|
|
|
|
1065
|
|
|
|
|
|
|
my $format = $string->format(10); |
1066
|
|
|
|
|
|
|
|
1067
|
|
|
|
|
|
|
# "id number 00000010" |
1068
|
|
|
|
|
|
|
|
1069
|
|
|
|
|
|
|
=back |
1070
|
|
|
|
|
|
|
|
1071
|
|
|
|
|
|
|
=cut |
1072
|
|
|
|
|
|
|
|
1073
|
|
|
|
|
|
|
=head2 ge |
1074
|
|
|
|
|
|
|
|
1075
|
|
|
|
|
|
|
ge(Any $arg) (Bool) |
1076
|
|
|
|
|
|
|
|
1077
|
|
|
|
|
|
|
The ge method performs a I<"greater-than-or-equal-to"> operation using the |
1078
|
|
|
|
|
|
|
argument provided. |
1079
|
|
|
|
|
|
|
|
1080
|
|
|
|
|
|
|
I> |
1081
|
|
|
|
|
|
|
|
1082
|
|
|
|
|
|
|
=over 4 |
1083
|
|
|
|
|
|
|
|
1084
|
|
|
|
|
|
|
=item ge example 1 |
1085
|
|
|
|
|
|
|
|
1086
|
|
|
|
|
|
|
package main; |
1087
|
|
|
|
|
|
|
|
1088
|
|
|
|
|
|
|
use Venus::Array; |
1089
|
|
|
|
|
|
|
use Venus::String; |
1090
|
|
|
|
|
|
|
|
1091
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1092
|
|
|
|
|
|
|
my $rvalue = Venus::Array->new; |
1093
|
|
|
|
|
|
|
|
1094
|
|
|
|
|
|
|
my $result = $lvalue->ge($rvalue); |
1095
|
|
|
|
|
|
|
|
1096
|
|
|
|
|
|
|
# 0 |
1097
|
|
|
|
|
|
|
|
1098
|
|
|
|
|
|
|
=back |
1099
|
|
|
|
|
|
|
|
1100
|
|
|
|
|
|
|
=over 4 |
1101
|
|
|
|
|
|
|
|
1102
|
|
|
|
|
|
|
=item ge example 2 |
1103
|
|
|
|
|
|
|
|
1104
|
|
|
|
|
|
|
package main; |
1105
|
|
|
|
|
|
|
|
1106
|
|
|
|
|
|
|
use Venus::Code; |
1107
|
|
|
|
|
|
|
use Venus::String; |
1108
|
|
|
|
|
|
|
|
1109
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1110
|
|
|
|
|
|
|
my $rvalue = Venus::Code->new; |
1111
|
|
|
|
|
|
|
|
1112
|
|
|
|
|
|
|
my $result = $lvalue->ge($rvalue); |
1113
|
|
|
|
|
|
|
|
1114
|
|
|
|
|
|
|
# 0 |
1115
|
|
|
|
|
|
|
|
1116
|
|
|
|
|
|
|
=back |
1117
|
|
|
|
|
|
|
|
1118
|
|
|
|
|
|
|
=over 4 |
1119
|
|
|
|
|
|
|
|
1120
|
|
|
|
|
|
|
=item ge example 3 |
1121
|
|
|
|
|
|
|
|
1122
|
|
|
|
|
|
|
package main; |
1123
|
|
|
|
|
|
|
|
1124
|
|
|
|
|
|
|
use Venus::Float; |
1125
|
|
|
|
|
|
|
use Venus::String; |
1126
|
|
|
|
|
|
|
|
1127
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1128
|
|
|
|
|
|
|
my $rvalue = Venus::Float->new; |
1129
|
|
|
|
|
|
|
|
1130
|
|
|
|
|
|
|
my $result = $lvalue->ge($rvalue); |
1131
|
|
|
|
|
|
|
|
1132
|
|
|
|
|
|
|
# 0 |
1133
|
|
|
|
|
|
|
|
1134
|
|
|
|
|
|
|
=back |
1135
|
|
|
|
|
|
|
|
1136
|
|
|
|
|
|
|
=over 4 |
1137
|
|
|
|
|
|
|
|
1138
|
|
|
|
|
|
|
=item ge example 4 |
1139
|
|
|
|
|
|
|
|
1140
|
|
|
|
|
|
|
package main; |
1141
|
|
|
|
|
|
|
|
1142
|
|
|
|
|
|
|
use Venus::Hash; |
1143
|
|
|
|
|
|
|
use Venus::String; |
1144
|
|
|
|
|
|
|
|
1145
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1146
|
|
|
|
|
|
|
my $rvalue = Venus::Hash->new; |
1147
|
|
|
|
|
|
|
|
1148
|
|
|
|
|
|
|
my $result = $lvalue->ge($rvalue); |
1149
|
|
|
|
|
|
|
|
1150
|
|
|
|
|
|
|
# 0 |
1151
|
|
|
|
|
|
|
|
1152
|
|
|
|
|
|
|
=back |
1153
|
|
|
|
|
|
|
|
1154
|
|
|
|
|
|
|
=over 4 |
1155
|
|
|
|
|
|
|
|
1156
|
|
|
|
|
|
|
=item ge example 5 |
1157
|
|
|
|
|
|
|
|
1158
|
|
|
|
|
|
|
package main; |
1159
|
|
|
|
|
|
|
|
1160
|
|
|
|
|
|
|
use Venus::Number; |
1161
|
|
|
|
|
|
|
use Venus::String; |
1162
|
|
|
|
|
|
|
|
1163
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1164
|
|
|
|
|
|
|
my $rvalue = Venus::Number->new; |
1165
|
|
|
|
|
|
|
|
1166
|
|
|
|
|
|
|
my $result = $lvalue->ge($rvalue); |
1167
|
|
|
|
|
|
|
|
1168
|
|
|
|
|
|
|
# 0 |
1169
|
|
|
|
|
|
|
|
1170
|
|
|
|
|
|
|
=back |
1171
|
|
|
|
|
|
|
|
1172
|
|
|
|
|
|
|
=over 4 |
1173
|
|
|
|
|
|
|
|
1174
|
|
|
|
|
|
|
=item ge example 6 |
1175
|
|
|
|
|
|
|
|
1176
|
|
|
|
|
|
|
package main; |
1177
|
|
|
|
|
|
|
|
1178
|
|
|
|
|
|
|
use Venus::Regexp; |
1179
|
|
|
|
|
|
|
use Venus::String; |
1180
|
|
|
|
|
|
|
|
1181
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1182
|
|
|
|
|
|
|
my $rvalue = Venus::Regexp->new; |
1183
|
|
|
|
|
|
|
|
1184
|
|
|
|
|
|
|
my $result = $lvalue->ge($rvalue); |
1185
|
|
|
|
|
|
|
|
1186
|
|
|
|
|
|
|
# 0 |
1187
|
|
|
|
|
|
|
|
1188
|
|
|
|
|
|
|
=back |
1189
|
|
|
|
|
|
|
|
1190
|
|
|
|
|
|
|
=over 4 |
1191
|
|
|
|
|
|
|
|
1192
|
|
|
|
|
|
|
=item ge example 7 |
1193
|
|
|
|
|
|
|
|
1194
|
|
|
|
|
|
|
package main; |
1195
|
|
|
|
|
|
|
|
1196
|
|
|
|
|
|
|
use Venus::Scalar; |
1197
|
|
|
|
|
|
|
use Venus::String; |
1198
|
|
|
|
|
|
|
|
1199
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1200
|
|
|
|
|
|
|
my $rvalue = Venus::Scalar->new; |
1201
|
|
|
|
|
|
|
|
1202
|
|
|
|
|
|
|
my $result = $lvalue->ge($rvalue); |
1203
|
|
|
|
|
|
|
|
1204
|
|
|
|
|
|
|
# 0 |
1205
|
|
|
|
|
|
|
|
1206
|
|
|
|
|
|
|
=back |
1207
|
|
|
|
|
|
|
|
1208
|
|
|
|
|
|
|
=over 4 |
1209
|
|
|
|
|
|
|
|
1210
|
|
|
|
|
|
|
=item ge example 8 |
1211
|
|
|
|
|
|
|
|
1212
|
|
|
|
|
|
|
package main; |
1213
|
|
|
|
|
|
|
|
1214
|
|
|
|
|
|
|
use Venus::String; |
1215
|
|
|
|
|
|
|
|
1216
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1217
|
|
|
|
|
|
|
my $rvalue = Venus::String->new; |
1218
|
|
|
|
|
|
|
|
1219
|
|
|
|
|
|
|
my $result = $lvalue->ge($rvalue); |
1220
|
|
|
|
|
|
|
|
1221
|
|
|
|
|
|
|
# 1 |
1222
|
|
|
|
|
|
|
|
1223
|
|
|
|
|
|
|
=back |
1224
|
|
|
|
|
|
|
|
1225
|
|
|
|
|
|
|
=over 4 |
1226
|
|
|
|
|
|
|
|
1227
|
|
|
|
|
|
|
=item ge example 9 |
1228
|
|
|
|
|
|
|
|
1229
|
|
|
|
|
|
|
package main; |
1230
|
|
|
|
|
|
|
|
1231
|
|
|
|
|
|
|
use Venus::String; |
1232
|
|
|
|
|
|
|
use Venus::Undef; |
1233
|
|
|
|
|
|
|
|
1234
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1235
|
|
|
|
|
|
|
my $rvalue = Venus::Undef->new; |
1236
|
|
|
|
|
|
|
|
1237
|
|
|
|
|
|
|
my $result = $lvalue->ge($rvalue); |
1238
|
|
|
|
|
|
|
|
1239
|
|
|
|
|
|
|
# 1 |
1240
|
|
|
|
|
|
|
|
1241
|
|
|
|
|
|
|
=back |
1242
|
|
|
|
|
|
|
|
1243
|
|
|
|
|
|
|
=cut |
1244
|
|
|
|
|
|
|
|
1245
|
|
|
|
|
|
|
=head2 gele |
1246
|
|
|
|
|
|
|
|
1247
|
|
|
|
|
|
|
gele(Any $arg1, Any $arg2) (Bool) |
1248
|
|
|
|
|
|
|
|
1249
|
|
|
|
|
|
|
The gele method performs a I<"greater-than-or-equal-to"> operation on the 1st |
1250
|
|
|
|
|
|
|
argument, and I<"lesser-than-or-equal-to"> operation on the 2nd argument. |
1251
|
|
|
|
|
|
|
|
1252
|
|
|
|
|
|
|
I> |
1253
|
|
|
|
|
|
|
|
1254
|
|
|
|
|
|
|
=over 4 |
1255
|
|
|
|
|
|
|
|
1256
|
|
|
|
|
|
|
=item gele example 1 |
1257
|
|
|
|
|
|
|
|
1258
|
|
|
|
|
|
|
package main; |
1259
|
|
|
|
|
|
|
|
1260
|
|
|
|
|
|
|
use Venus::Array; |
1261
|
|
|
|
|
|
|
use Venus::String; |
1262
|
|
|
|
|
|
|
|
1263
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1264
|
|
|
|
|
|
|
my $rvalue = Venus::Array->new; |
1265
|
|
|
|
|
|
|
|
1266
|
|
|
|
|
|
|
my $result = $lvalue->gele($rvalue); |
1267
|
|
|
|
|
|
|
|
1268
|
|
|
|
|
|
|
# 0 |
1269
|
|
|
|
|
|
|
|
1270
|
|
|
|
|
|
|
=back |
1271
|
|
|
|
|
|
|
|
1272
|
|
|
|
|
|
|
=over 4 |
1273
|
|
|
|
|
|
|
|
1274
|
|
|
|
|
|
|
=item gele example 2 |
1275
|
|
|
|
|
|
|
|
1276
|
|
|
|
|
|
|
package main; |
1277
|
|
|
|
|
|
|
|
1278
|
|
|
|
|
|
|
use Venus::Code; |
1279
|
|
|
|
|
|
|
use Venus::String; |
1280
|
|
|
|
|
|
|
|
1281
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1282
|
|
|
|
|
|
|
my $rvalue = Venus::Code->new; |
1283
|
|
|
|
|
|
|
|
1284
|
|
|
|
|
|
|
my $result = $lvalue->gele($rvalue); |
1285
|
|
|
|
|
|
|
|
1286
|
|
|
|
|
|
|
# 0 |
1287
|
|
|
|
|
|
|
|
1288
|
|
|
|
|
|
|
=back |
1289
|
|
|
|
|
|
|
|
1290
|
|
|
|
|
|
|
=over 4 |
1291
|
|
|
|
|
|
|
|
1292
|
|
|
|
|
|
|
=item gele example 3 |
1293
|
|
|
|
|
|
|
|
1294
|
|
|
|
|
|
|
package main; |
1295
|
|
|
|
|
|
|
|
1296
|
|
|
|
|
|
|
use Venus::Float; |
1297
|
|
|
|
|
|
|
use Venus::String; |
1298
|
|
|
|
|
|
|
|
1299
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1300
|
|
|
|
|
|
|
my $rvalue = Venus::Float->new; |
1301
|
|
|
|
|
|
|
|
1302
|
|
|
|
|
|
|
my $result = $lvalue->gele($rvalue); |
1303
|
|
|
|
|
|
|
|
1304
|
|
|
|
|
|
|
# 0 |
1305
|
|
|
|
|
|
|
|
1306
|
|
|
|
|
|
|
=back |
1307
|
|
|
|
|
|
|
|
1308
|
|
|
|
|
|
|
=over 4 |
1309
|
|
|
|
|
|
|
|
1310
|
|
|
|
|
|
|
=item gele example 4 |
1311
|
|
|
|
|
|
|
|
1312
|
|
|
|
|
|
|
package main; |
1313
|
|
|
|
|
|
|
|
1314
|
|
|
|
|
|
|
use Venus::Hash; |
1315
|
|
|
|
|
|
|
use Venus::String; |
1316
|
|
|
|
|
|
|
|
1317
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1318
|
|
|
|
|
|
|
my $rvalue = Venus::Hash->new; |
1319
|
|
|
|
|
|
|
|
1320
|
|
|
|
|
|
|
my $result = $lvalue->gele($rvalue); |
1321
|
|
|
|
|
|
|
|
1322
|
|
|
|
|
|
|
# 0 |
1323
|
|
|
|
|
|
|
|
1324
|
|
|
|
|
|
|
=back |
1325
|
|
|
|
|
|
|
|
1326
|
|
|
|
|
|
|
=over 4 |
1327
|
|
|
|
|
|
|
|
1328
|
|
|
|
|
|
|
=item gele example 5 |
1329
|
|
|
|
|
|
|
|
1330
|
|
|
|
|
|
|
package main; |
1331
|
|
|
|
|
|
|
|
1332
|
|
|
|
|
|
|
use Venus::Number; |
1333
|
|
|
|
|
|
|
use Venus::String; |
1334
|
|
|
|
|
|
|
|
1335
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1336
|
|
|
|
|
|
|
my $rvalue = Venus::Number->new; |
1337
|
|
|
|
|
|
|
|
1338
|
|
|
|
|
|
|
my $result = $lvalue->gele($rvalue); |
1339
|
|
|
|
|
|
|
|
1340
|
|
|
|
|
|
|
# 0 |
1341
|
|
|
|
|
|
|
|
1342
|
|
|
|
|
|
|
=back |
1343
|
|
|
|
|
|
|
|
1344
|
|
|
|
|
|
|
=over 4 |
1345
|
|
|
|
|
|
|
|
1346
|
|
|
|
|
|
|
=item gele example 6 |
1347
|
|
|
|
|
|
|
|
1348
|
|
|
|
|
|
|
package main; |
1349
|
|
|
|
|
|
|
|
1350
|
|
|
|
|
|
|
use Venus::Regexp; |
1351
|
|
|
|
|
|
|
use Venus::String; |
1352
|
|
|
|
|
|
|
|
1353
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1354
|
|
|
|
|
|
|
my $rvalue = Venus::Regexp->new; |
1355
|
|
|
|
|
|
|
|
1356
|
|
|
|
|
|
|
my $result = $lvalue->gele($rvalue); |
1357
|
|
|
|
|
|
|
|
1358
|
|
|
|
|
|
|
# 0 |
1359
|
|
|
|
|
|
|
|
1360
|
|
|
|
|
|
|
=back |
1361
|
|
|
|
|
|
|
|
1362
|
|
|
|
|
|
|
=over 4 |
1363
|
|
|
|
|
|
|
|
1364
|
|
|
|
|
|
|
=item gele example 7 |
1365
|
|
|
|
|
|
|
|
1366
|
|
|
|
|
|
|
package main; |
1367
|
|
|
|
|
|
|
|
1368
|
|
|
|
|
|
|
use Venus::Scalar; |
1369
|
|
|
|
|
|
|
use Venus::String; |
1370
|
|
|
|
|
|
|
|
1371
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1372
|
|
|
|
|
|
|
my $rvalue = Venus::Scalar->new; |
1373
|
|
|
|
|
|
|
|
1374
|
|
|
|
|
|
|
my $result = $lvalue->gele($rvalue); |
1375
|
|
|
|
|
|
|
|
1376
|
|
|
|
|
|
|
# 0 |
1377
|
|
|
|
|
|
|
|
1378
|
|
|
|
|
|
|
=back |
1379
|
|
|
|
|
|
|
|
1380
|
|
|
|
|
|
|
=over 4 |
1381
|
|
|
|
|
|
|
|
1382
|
|
|
|
|
|
|
=item gele example 8 |
1383
|
|
|
|
|
|
|
|
1384
|
|
|
|
|
|
|
package main; |
1385
|
|
|
|
|
|
|
|
1386
|
|
|
|
|
|
|
use Venus::String; |
1387
|
|
|
|
|
|
|
|
1388
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1389
|
|
|
|
|
|
|
my $rvalue = Venus::String->new; |
1390
|
|
|
|
|
|
|
|
1391
|
|
|
|
|
|
|
my $result = $lvalue->gele($rvalue); |
1392
|
|
|
|
|
|
|
|
1393
|
|
|
|
|
|
|
# 1 |
1394
|
|
|
|
|
|
|
|
1395
|
|
|
|
|
|
|
=back |
1396
|
|
|
|
|
|
|
|
1397
|
|
|
|
|
|
|
=over 4 |
1398
|
|
|
|
|
|
|
|
1399
|
|
|
|
|
|
|
=item gele example 9 |
1400
|
|
|
|
|
|
|
|
1401
|
|
|
|
|
|
|
package main; |
1402
|
|
|
|
|
|
|
|
1403
|
|
|
|
|
|
|
use Venus::String; |
1404
|
|
|
|
|
|
|
use Venus::Undef; |
1405
|
|
|
|
|
|
|
|
1406
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1407
|
|
|
|
|
|
|
my $rvalue = Venus::Undef->new; |
1408
|
|
|
|
|
|
|
|
1409
|
|
|
|
|
|
|
my $result = $lvalue->gele($rvalue); |
1410
|
|
|
|
|
|
|
|
1411
|
|
|
|
|
|
|
# 1 |
1412
|
|
|
|
|
|
|
|
1413
|
|
|
|
|
|
|
=back |
1414
|
|
|
|
|
|
|
|
1415
|
|
|
|
|
|
|
=cut |
1416
|
|
|
|
|
|
|
|
1417
|
|
|
|
|
|
|
=head2 gt |
1418
|
|
|
|
|
|
|
|
1419
|
|
|
|
|
|
|
gt(Any $arg) (Bool) |
1420
|
|
|
|
|
|
|
|
1421
|
|
|
|
|
|
|
The gt method performs a I<"greater-than"> operation using the argument provided. |
1422
|
|
|
|
|
|
|
|
1423
|
|
|
|
|
|
|
I> |
1424
|
|
|
|
|
|
|
|
1425
|
|
|
|
|
|
|
=over 4 |
1426
|
|
|
|
|
|
|
|
1427
|
|
|
|
|
|
|
=item gt example 1 |
1428
|
|
|
|
|
|
|
|
1429
|
|
|
|
|
|
|
package main; |
1430
|
|
|
|
|
|
|
|
1431
|
|
|
|
|
|
|
use Venus::Array; |
1432
|
|
|
|
|
|
|
use Venus::String; |
1433
|
|
|
|
|
|
|
|
1434
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1435
|
|
|
|
|
|
|
my $rvalue = Venus::Array->new; |
1436
|
|
|
|
|
|
|
|
1437
|
|
|
|
|
|
|
my $result = $lvalue->gt($rvalue); |
1438
|
|
|
|
|
|
|
|
1439
|
|
|
|
|
|
|
# 0 |
1440
|
|
|
|
|
|
|
|
1441
|
|
|
|
|
|
|
=back |
1442
|
|
|
|
|
|
|
|
1443
|
|
|
|
|
|
|
=over 4 |
1444
|
|
|
|
|
|
|
|
1445
|
|
|
|
|
|
|
=item gt example 2 |
1446
|
|
|
|
|
|
|
|
1447
|
|
|
|
|
|
|
package main; |
1448
|
|
|
|
|
|
|
|
1449
|
|
|
|
|
|
|
use Venus::Code; |
1450
|
|
|
|
|
|
|
use Venus::String; |
1451
|
|
|
|
|
|
|
|
1452
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1453
|
|
|
|
|
|
|
my $rvalue = Venus::Code->new; |
1454
|
|
|
|
|
|
|
|
1455
|
|
|
|
|
|
|
my $result = $lvalue->gt($rvalue); |
1456
|
|
|
|
|
|
|
|
1457
|
|
|
|
|
|
|
# 0 |
1458
|
|
|
|
|
|
|
|
1459
|
|
|
|
|
|
|
=back |
1460
|
|
|
|
|
|
|
|
1461
|
|
|
|
|
|
|
=over 4 |
1462
|
|
|
|
|
|
|
|
1463
|
|
|
|
|
|
|
=item gt example 3 |
1464
|
|
|
|
|
|
|
|
1465
|
|
|
|
|
|
|
package main; |
1466
|
|
|
|
|
|
|
|
1467
|
|
|
|
|
|
|
use Venus::Float; |
1468
|
|
|
|
|
|
|
use Venus::String; |
1469
|
|
|
|
|
|
|
|
1470
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1471
|
|
|
|
|
|
|
my $rvalue = Venus::Float->new; |
1472
|
|
|
|
|
|
|
|
1473
|
|
|
|
|
|
|
my $result = $lvalue->gt($rvalue); |
1474
|
|
|
|
|
|
|
|
1475
|
|
|
|
|
|
|
# 0 |
1476
|
|
|
|
|
|
|
|
1477
|
|
|
|
|
|
|
=back |
1478
|
|
|
|
|
|
|
|
1479
|
|
|
|
|
|
|
=over 4 |
1480
|
|
|
|
|
|
|
|
1481
|
|
|
|
|
|
|
=item gt example 4 |
1482
|
|
|
|
|
|
|
|
1483
|
|
|
|
|
|
|
package main; |
1484
|
|
|
|
|
|
|
|
1485
|
|
|
|
|
|
|
use Venus::Hash; |
1486
|
|
|
|
|
|
|
use Venus::String; |
1487
|
|
|
|
|
|
|
|
1488
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1489
|
|
|
|
|
|
|
my $rvalue = Venus::Hash->new; |
1490
|
|
|
|
|
|
|
|
1491
|
|
|
|
|
|
|
my $result = $lvalue->gt($rvalue); |
1492
|
|
|
|
|
|
|
|
1493
|
|
|
|
|
|
|
# 0 |
1494
|
|
|
|
|
|
|
|
1495
|
|
|
|
|
|
|
=back |
1496
|
|
|
|
|
|
|
|
1497
|
|
|
|
|
|
|
=over 4 |
1498
|
|
|
|
|
|
|
|
1499
|
|
|
|
|
|
|
=item gt example 5 |
1500
|
|
|
|
|
|
|
|
1501
|
|
|
|
|
|
|
package main; |
1502
|
|
|
|
|
|
|
|
1503
|
|
|
|
|
|
|
use Venus::Number; |
1504
|
|
|
|
|
|
|
use Venus::String; |
1505
|
|
|
|
|
|
|
|
1506
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1507
|
|
|
|
|
|
|
my $rvalue = Venus::Number->new; |
1508
|
|
|
|
|
|
|
|
1509
|
|
|
|
|
|
|
my $result = $lvalue->gt($rvalue); |
1510
|
|
|
|
|
|
|
|
1511
|
|
|
|
|
|
|
# 0 |
1512
|
|
|
|
|
|
|
|
1513
|
|
|
|
|
|
|
=back |
1514
|
|
|
|
|
|
|
|
1515
|
|
|
|
|
|
|
=over 4 |
1516
|
|
|
|
|
|
|
|
1517
|
|
|
|
|
|
|
=item gt example 6 |
1518
|
|
|
|
|
|
|
|
1519
|
|
|
|
|
|
|
package main; |
1520
|
|
|
|
|
|
|
|
1521
|
|
|
|
|
|
|
use Venus::Regexp; |
1522
|
|
|
|
|
|
|
use Venus::String; |
1523
|
|
|
|
|
|
|
|
1524
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1525
|
|
|
|
|
|
|
my $rvalue = Venus::Regexp->new; |
1526
|
|
|
|
|
|
|
|
1527
|
|
|
|
|
|
|
my $result = $lvalue->gt($rvalue); |
1528
|
|
|
|
|
|
|
|
1529
|
|
|
|
|
|
|
# 0 |
1530
|
|
|
|
|
|
|
|
1531
|
|
|
|
|
|
|
=back |
1532
|
|
|
|
|
|
|
|
1533
|
|
|
|
|
|
|
=over 4 |
1534
|
|
|
|
|
|
|
|
1535
|
|
|
|
|
|
|
=item gt example 7 |
1536
|
|
|
|
|
|
|
|
1537
|
|
|
|
|
|
|
package main; |
1538
|
|
|
|
|
|
|
|
1539
|
|
|
|
|
|
|
use Venus::Scalar; |
1540
|
|
|
|
|
|
|
use Venus::String; |
1541
|
|
|
|
|
|
|
|
1542
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1543
|
|
|
|
|
|
|
my $rvalue = Venus::Scalar->new; |
1544
|
|
|
|
|
|
|
|
1545
|
|
|
|
|
|
|
my $result = $lvalue->gt($rvalue); |
1546
|
|
|
|
|
|
|
|
1547
|
|
|
|
|
|
|
# 0 |
1548
|
|
|
|
|
|
|
|
1549
|
|
|
|
|
|
|
=back |
1550
|
|
|
|
|
|
|
|
1551
|
|
|
|
|
|
|
=over 4 |
1552
|
|
|
|
|
|
|
|
1553
|
|
|
|
|
|
|
=item gt example 8 |
1554
|
|
|
|
|
|
|
|
1555
|
|
|
|
|
|
|
package main; |
1556
|
|
|
|
|
|
|
|
1557
|
|
|
|
|
|
|
use Venus::String; |
1558
|
|
|
|
|
|
|
|
1559
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1560
|
|
|
|
|
|
|
my $rvalue = Venus::String->new; |
1561
|
|
|
|
|
|
|
|
1562
|
|
|
|
|
|
|
my $result = $lvalue->gt($rvalue); |
1563
|
|
|
|
|
|
|
|
1564
|
|
|
|
|
|
|
# 0 |
1565
|
|
|
|
|
|
|
|
1566
|
|
|
|
|
|
|
=back |
1567
|
|
|
|
|
|
|
|
1568
|
|
|
|
|
|
|
=over 4 |
1569
|
|
|
|
|
|
|
|
1570
|
|
|
|
|
|
|
=item gt example 9 |
1571
|
|
|
|
|
|
|
|
1572
|
|
|
|
|
|
|
package main; |
1573
|
|
|
|
|
|
|
|
1574
|
|
|
|
|
|
|
use Venus::String; |
1575
|
|
|
|
|
|
|
use Venus::Undef; |
1576
|
|
|
|
|
|
|
|
1577
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1578
|
|
|
|
|
|
|
my $rvalue = Venus::Undef->new; |
1579
|
|
|
|
|
|
|
|
1580
|
|
|
|
|
|
|
my $result = $lvalue->gt($rvalue); |
1581
|
|
|
|
|
|
|
|
1582
|
|
|
|
|
|
|
# 0 |
1583
|
|
|
|
|
|
|
|
1584
|
|
|
|
|
|
|
=back |
1585
|
|
|
|
|
|
|
|
1586
|
|
|
|
|
|
|
=cut |
1587
|
|
|
|
|
|
|
|
1588
|
|
|
|
|
|
|
=head2 gtlt |
1589
|
|
|
|
|
|
|
|
1590
|
|
|
|
|
|
|
gtlt(Any $arg1, Any $arg2) (Bool) |
1591
|
|
|
|
|
|
|
|
1592
|
|
|
|
|
|
|
The gtlt method performs a I<"greater-than"> operation on the 1st argument, and |
1593
|
|
|
|
|
|
|
I<"lesser-than"> operation on the 2nd argument. |
1594
|
|
|
|
|
|
|
|
1595
|
|
|
|
|
|
|
I> |
1596
|
|
|
|
|
|
|
|
1597
|
|
|
|
|
|
|
=over 4 |
1598
|
|
|
|
|
|
|
|
1599
|
|
|
|
|
|
|
=item gtlt example 1 |
1600
|
|
|
|
|
|
|
|
1601
|
|
|
|
|
|
|
package main; |
1602
|
|
|
|
|
|
|
|
1603
|
|
|
|
|
|
|
use Venus::Array; |
1604
|
|
|
|
|
|
|
use Venus::String; |
1605
|
|
|
|
|
|
|
|
1606
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1607
|
|
|
|
|
|
|
my $rvalue = Venus::Array->new; |
1608
|
|
|
|
|
|
|
|
1609
|
|
|
|
|
|
|
my $result = $lvalue->gtlt($rvalue); |
1610
|
|
|
|
|
|
|
|
1611
|
|
|
|
|
|
|
# 0 |
1612
|
|
|
|
|
|
|
|
1613
|
|
|
|
|
|
|
=back |
1614
|
|
|
|
|
|
|
|
1615
|
|
|
|
|
|
|
=over 4 |
1616
|
|
|
|
|
|
|
|
1617
|
|
|
|
|
|
|
=item gtlt example 2 |
1618
|
|
|
|
|
|
|
|
1619
|
|
|
|
|
|
|
package main; |
1620
|
|
|
|
|
|
|
|
1621
|
|
|
|
|
|
|
use Venus::Code; |
1622
|
|
|
|
|
|
|
use Venus::String; |
1623
|
|
|
|
|
|
|
|
1624
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1625
|
|
|
|
|
|
|
my $rvalue = Venus::Code->new; |
1626
|
|
|
|
|
|
|
|
1627
|
|
|
|
|
|
|
my $result = $lvalue->gtlt($rvalue); |
1628
|
|
|
|
|
|
|
|
1629
|
|
|
|
|
|
|
# 0 |
1630
|
|
|
|
|
|
|
|
1631
|
|
|
|
|
|
|
=back |
1632
|
|
|
|
|
|
|
|
1633
|
|
|
|
|
|
|
=over 4 |
1634
|
|
|
|
|
|
|
|
1635
|
|
|
|
|
|
|
=item gtlt example 3 |
1636
|
|
|
|
|
|
|
|
1637
|
|
|
|
|
|
|
package main; |
1638
|
|
|
|
|
|
|
|
1639
|
|
|
|
|
|
|
use Venus::Float; |
1640
|
|
|
|
|
|
|
use Venus::String; |
1641
|
|
|
|
|
|
|
|
1642
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1643
|
|
|
|
|
|
|
my $rvalue = Venus::Float->new; |
1644
|
|
|
|
|
|
|
|
1645
|
|
|
|
|
|
|
my $result = $lvalue->gtlt($rvalue); |
1646
|
|
|
|
|
|
|
|
1647
|
|
|
|
|
|
|
# 0 |
1648
|
|
|
|
|
|
|
|
1649
|
|
|
|
|
|
|
=back |
1650
|
|
|
|
|
|
|
|
1651
|
|
|
|
|
|
|
=over 4 |
1652
|
|
|
|
|
|
|
|
1653
|
|
|
|
|
|
|
=item gtlt example 4 |
1654
|
|
|
|
|
|
|
|
1655
|
|
|
|
|
|
|
package main; |
1656
|
|
|
|
|
|
|
|
1657
|
|
|
|
|
|
|
use Venus::Hash; |
1658
|
|
|
|
|
|
|
use Venus::String; |
1659
|
|
|
|
|
|
|
|
1660
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1661
|
|
|
|
|
|
|
my $rvalue = Venus::Hash->new; |
1662
|
|
|
|
|
|
|
|
1663
|
|
|
|
|
|
|
my $result = $lvalue->gtlt($rvalue); |
1664
|
|
|
|
|
|
|
|
1665
|
|
|
|
|
|
|
# 0 |
1666
|
|
|
|
|
|
|
|
1667
|
|
|
|
|
|
|
=back |
1668
|
|
|
|
|
|
|
|
1669
|
|
|
|
|
|
|
=over 4 |
1670
|
|
|
|
|
|
|
|
1671
|
|
|
|
|
|
|
=item gtlt example 5 |
1672
|
|
|
|
|
|
|
|
1673
|
|
|
|
|
|
|
package main; |
1674
|
|
|
|
|
|
|
|
1675
|
|
|
|
|
|
|
use Venus::Number; |
1676
|
|
|
|
|
|
|
use Venus::String; |
1677
|
|
|
|
|
|
|
|
1678
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1679
|
|
|
|
|
|
|
my $rvalue = Venus::Number->new; |
1680
|
|
|
|
|
|
|
|
1681
|
|
|
|
|
|
|
my $result = $lvalue->gtlt($rvalue); |
1682
|
|
|
|
|
|
|
|
1683
|
|
|
|
|
|
|
# 0 |
1684
|
|
|
|
|
|
|
|
1685
|
|
|
|
|
|
|
=back |
1686
|
|
|
|
|
|
|
|
1687
|
|
|
|
|
|
|
=over 4 |
1688
|
|
|
|
|
|
|
|
1689
|
|
|
|
|
|
|
=item gtlt example 6 |
1690
|
|
|
|
|
|
|
|
1691
|
|
|
|
|
|
|
package main; |
1692
|
|
|
|
|
|
|
|
1693
|
|
|
|
|
|
|
use Venus::Regexp; |
1694
|
|
|
|
|
|
|
use Venus::String; |
1695
|
|
|
|
|
|
|
|
1696
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1697
|
|
|
|
|
|
|
my $rvalue = Venus::Regexp->new; |
1698
|
|
|
|
|
|
|
|
1699
|
|
|
|
|
|
|
my $result = $lvalue->gtlt($rvalue); |
1700
|
|
|
|
|
|
|
|
1701
|
|
|
|
|
|
|
# 0 |
1702
|
|
|
|
|
|
|
|
1703
|
|
|
|
|
|
|
=back |
1704
|
|
|
|
|
|
|
|
1705
|
|
|
|
|
|
|
=over 4 |
1706
|
|
|
|
|
|
|
|
1707
|
|
|
|
|
|
|
=item gtlt example 7 |
1708
|
|
|
|
|
|
|
|
1709
|
|
|
|
|
|
|
package main; |
1710
|
|
|
|
|
|
|
|
1711
|
|
|
|
|
|
|
use Venus::Scalar; |
1712
|
|
|
|
|
|
|
use Venus::String; |
1713
|
|
|
|
|
|
|
|
1714
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1715
|
|
|
|
|
|
|
my $rvalue = Venus::Scalar->new; |
1716
|
|
|
|
|
|
|
|
1717
|
|
|
|
|
|
|
my $result = $lvalue->gtlt($rvalue); |
1718
|
|
|
|
|
|
|
|
1719
|
|
|
|
|
|
|
# 0 |
1720
|
|
|
|
|
|
|
|
1721
|
|
|
|
|
|
|
=back |
1722
|
|
|
|
|
|
|
|
1723
|
|
|
|
|
|
|
=over 4 |
1724
|
|
|
|
|
|
|
|
1725
|
|
|
|
|
|
|
=item gtlt example 8 |
1726
|
|
|
|
|
|
|
|
1727
|
|
|
|
|
|
|
package main; |
1728
|
|
|
|
|
|
|
|
1729
|
|
|
|
|
|
|
use Venus::String; |
1730
|
|
|
|
|
|
|
|
1731
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1732
|
|
|
|
|
|
|
my $rvalue = Venus::String->new; |
1733
|
|
|
|
|
|
|
|
1734
|
|
|
|
|
|
|
my $result = $lvalue->gtlt($rvalue); |
1735
|
|
|
|
|
|
|
|
1736
|
|
|
|
|
|
|
# 0 |
1737
|
|
|
|
|
|
|
|
1738
|
|
|
|
|
|
|
=back |
1739
|
|
|
|
|
|
|
|
1740
|
|
|
|
|
|
|
=over 4 |
1741
|
|
|
|
|
|
|
|
1742
|
|
|
|
|
|
|
=item gtlt example 9 |
1743
|
|
|
|
|
|
|
|
1744
|
|
|
|
|
|
|
package main; |
1745
|
|
|
|
|
|
|
|
1746
|
|
|
|
|
|
|
use Venus::String; |
1747
|
|
|
|
|
|
|
use Venus::Undef; |
1748
|
|
|
|
|
|
|
|
1749
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1750
|
|
|
|
|
|
|
my $rvalue = Venus::Undef->new; |
1751
|
|
|
|
|
|
|
|
1752
|
|
|
|
|
|
|
my $result = $lvalue->gtlt($rvalue); |
1753
|
|
|
|
|
|
|
|
1754
|
|
|
|
|
|
|
# 0 |
1755
|
|
|
|
|
|
|
|
1756
|
|
|
|
|
|
|
=back |
1757
|
|
|
|
|
|
|
|
1758
|
|
|
|
|
|
|
=cut |
1759
|
|
|
|
|
|
|
|
1760
|
|
|
|
|
|
|
=head2 hex |
1761
|
|
|
|
|
|
|
|
1762
|
|
|
|
|
|
|
hex() (Str) |
1763
|
|
|
|
|
|
|
|
1764
|
|
|
|
|
|
|
The hex method returns the value resulting from interpreting the string as a |
1765
|
|
|
|
|
|
|
hex string. |
1766
|
|
|
|
|
|
|
|
1767
|
|
|
|
|
|
|
I> |
1768
|
|
|
|
|
|
|
|
1769
|
|
|
|
|
|
|
=over 4 |
1770
|
|
|
|
|
|
|
|
1771
|
|
|
|
|
|
|
=item hex example 1 |
1772
|
|
|
|
|
|
|
|
1773
|
|
|
|
|
|
|
package main; |
1774
|
|
|
|
|
|
|
|
1775
|
|
|
|
|
|
|
use Venus::String; |
1776
|
|
|
|
|
|
|
|
1777
|
|
|
|
|
|
|
my $string = Venus::String->new('0xaf'); |
1778
|
|
|
|
|
|
|
|
1779
|
|
|
|
|
|
|
my $hex = $string->hex; |
1780
|
|
|
|
|
|
|
|
1781
|
|
|
|
|
|
|
# 175 |
1782
|
|
|
|
|
|
|
|
1783
|
|
|
|
|
|
|
=back |
1784
|
|
|
|
|
|
|
|
1785
|
|
|
|
|
|
|
=cut |
1786
|
|
|
|
|
|
|
|
1787
|
|
|
|
|
|
|
=head2 index |
1788
|
|
|
|
|
|
|
|
1789
|
|
|
|
|
|
|
index(Str $substr, Int $start) (Num) |
1790
|
|
|
|
|
|
|
|
1791
|
|
|
|
|
|
|
The index method searches for the argument within the string and returns the |
1792
|
|
|
|
|
|
|
position of the first occurrence of the argument. |
1793
|
|
|
|
|
|
|
|
1794
|
|
|
|
|
|
|
I> |
1795
|
|
|
|
|
|
|
|
1796
|
|
|
|
|
|
|
=over 4 |
1797
|
|
|
|
|
|
|
|
1798
|
|
|
|
|
|
|
=item index example 1 |
1799
|
|
|
|
|
|
|
|
1800
|
|
|
|
|
|
|
package main; |
1801
|
|
|
|
|
|
|
|
1802
|
|
|
|
|
|
|
use Venus::String; |
1803
|
|
|
|
|
|
|
|
1804
|
|
|
|
|
|
|
my $string = Venus::String->new('unexplainable'); |
1805
|
|
|
|
|
|
|
|
1806
|
|
|
|
|
|
|
my $index = $string->index('explain'); |
1807
|
|
|
|
|
|
|
|
1808
|
|
|
|
|
|
|
# 2 |
1809
|
|
|
|
|
|
|
|
1810
|
|
|
|
|
|
|
=back |
1811
|
|
|
|
|
|
|
|
1812
|
|
|
|
|
|
|
=over 4 |
1813
|
|
|
|
|
|
|
|
1814
|
|
|
|
|
|
|
=item index example 2 |
1815
|
|
|
|
|
|
|
|
1816
|
|
|
|
|
|
|
package main; |
1817
|
|
|
|
|
|
|
|
1818
|
|
|
|
|
|
|
use Venus::String; |
1819
|
|
|
|
|
|
|
|
1820
|
|
|
|
|
|
|
my $string = Venus::String->new('unexplainable'); |
1821
|
|
|
|
|
|
|
|
1822
|
|
|
|
|
|
|
my $index = $string->index('explain', 1); |
1823
|
|
|
|
|
|
|
|
1824
|
|
|
|
|
|
|
# 2 |
1825
|
|
|
|
|
|
|
|
1826
|
|
|
|
|
|
|
=back |
1827
|
|
|
|
|
|
|
|
1828
|
|
|
|
|
|
|
=over 4 |
1829
|
|
|
|
|
|
|
|
1830
|
|
|
|
|
|
|
=item index example 3 |
1831
|
|
|
|
|
|
|
|
1832
|
|
|
|
|
|
|
package main; |
1833
|
|
|
|
|
|
|
|
1834
|
|
|
|
|
|
|
use Venus::String; |
1835
|
|
|
|
|
|
|
|
1836
|
|
|
|
|
|
|
my $string = Venus::String->new('unexplainable'); |
1837
|
|
|
|
|
|
|
|
1838
|
|
|
|
|
|
|
my $index = $string->index('explained'); |
1839
|
|
|
|
|
|
|
|
1840
|
|
|
|
|
|
|
# -1 |
1841
|
|
|
|
|
|
|
|
1842
|
|
|
|
|
|
|
=back |
1843
|
|
|
|
|
|
|
|
1844
|
|
|
|
|
|
|
=cut |
1845
|
|
|
|
|
|
|
|
1846
|
|
|
|
|
|
|
=head2 kebabcase |
1847
|
|
|
|
|
|
|
|
1848
|
|
|
|
|
|
|
kebabcase() (Str) |
1849
|
|
|
|
|
|
|
|
1850
|
|
|
|
|
|
|
The kebabcase method converts the string to kebabcase. |
1851
|
|
|
|
|
|
|
|
1852
|
|
|
|
|
|
|
I> |
1853
|
|
|
|
|
|
|
|
1854
|
|
|
|
|
|
|
=over 4 |
1855
|
|
|
|
|
|
|
|
1856
|
|
|
|
|
|
|
=item kebabcase example 1 |
1857
|
|
|
|
|
|
|
|
1858
|
|
|
|
|
|
|
# given: synopsis; |
1859
|
|
|
|
|
|
|
|
1860
|
|
|
|
|
|
|
my $kebabcase = $string->kebabcase; |
1861
|
|
|
|
|
|
|
|
1862
|
|
|
|
|
|
|
# "hello-world" |
1863
|
|
|
|
|
|
|
|
1864
|
|
|
|
|
|
|
=back |
1865
|
|
|
|
|
|
|
|
1866
|
|
|
|
|
|
|
=cut |
1867
|
|
|
|
|
|
|
|
1868
|
|
|
|
|
|
|
=head2 lc |
1869
|
|
|
|
|
|
|
|
1870
|
|
|
|
|
|
|
lc() (Str) |
1871
|
|
|
|
|
|
|
|
1872
|
|
|
|
|
|
|
The lc method returns a lowercased version of the string. |
1873
|
|
|
|
|
|
|
|
1874
|
|
|
|
|
|
|
I> |
1875
|
|
|
|
|
|
|
|
1876
|
|
|
|
|
|
|
=over 4 |
1877
|
|
|
|
|
|
|
|
1878
|
|
|
|
|
|
|
=item lc example 1 |
1879
|
|
|
|
|
|
|
|
1880
|
|
|
|
|
|
|
package main; |
1881
|
|
|
|
|
|
|
|
1882
|
|
|
|
|
|
|
use Venus::String; |
1883
|
|
|
|
|
|
|
|
1884
|
|
|
|
|
|
|
my $string = Venus::String->new('Hello World'); |
1885
|
|
|
|
|
|
|
|
1886
|
|
|
|
|
|
|
my $lc = $string->lc; |
1887
|
|
|
|
|
|
|
|
1888
|
|
|
|
|
|
|
# "hello world" |
1889
|
|
|
|
|
|
|
|
1890
|
|
|
|
|
|
|
=back |
1891
|
|
|
|
|
|
|
|
1892
|
|
|
|
|
|
|
=cut |
1893
|
|
|
|
|
|
|
|
1894
|
|
|
|
|
|
|
=head2 lcfirst |
1895
|
|
|
|
|
|
|
|
1896
|
|
|
|
|
|
|
lcfirst() (Str) |
1897
|
|
|
|
|
|
|
|
1898
|
|
|
|
|
|
|
The lcfirst method returns a the string with the first character lowercased. |
1899
|
|
|
|
|
|
|
|
1900
|
|
|
|
|
|
|
I> |
1901
|
|
|
|
|
|
|
|
1902
|
|
|
|
|
|
|
=over 4 |
1903
|
|
|
|
|
|
|
|
1904
|
|
|
|
|
|
|
=item lcfirst example 1 |
1905
|
|
|
|
|
|
|
|
1906
|
|
|
|
|
|
|
package main; |
1907
|
|
|
|
|
|
|
|
1908
|
|
|
|
|
|
|
use Venus::String; |
1909
|
|
|
|
|
|
|
|
1910
|
|
|
|
|
|
|
my $string = Venus::String->new('Hello World'); |
1911
|
|
|
|
|
|
|
|
1912
|
|
|
|
|
|
|
my $lcfirst = $string->lcfirst; |
1913
|
|
|
|
|
|
|
|
1914
|
|
|
|
|
|
|
# "hello World" |
1915
|
|
|
|
|
|
|
|
1916
|
|
|
|
|
|
|
=back |
1917
|
|
|
|
|
|
|
|
1918
|
|
|
|
|
|
|
=cut |
1919
|
|
|
|
|
|
|
|
1920
|
|
|
|
|
|
|
=head2 le |
1921
|
|
|
|
|
|
|
|
1922
|
|
|
|
|
|
|
le(Any $arg) (Bool) |
1923
|
|
|
|
|
|
|
|
1924
|
|
|
|
|
|
|
The le method performs a I<"lesser-than-or-equal-to"> operation using the |
1925
|
|
|
|
|
|
|
argument provided. |
1926
|
|
|
|
|
|
|
|
1927
|
|
|
|
|
|
|
I> |
1928
|
|
|
|
|
|
|
|
1929
|
|
|
|
|
|
|
=over 4 |
1930
|
|
|
|
|
|
|
|
1931
|
|
|
|
|
|
|
=item le example 1 |
1932
|
|
|
|
|
|
|
|
1933
|
|
|
|
|
|
|
package main; |
1934
|
|
|
|
|
|
|
|
1935
|
|
|
|
|
|
|
use Venus::Array; |
1936
|
|
|
|
|
|
|
use Venus::String; |
1937
|
|
|
|
|
|
|
|
1938
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1939
|
|
|
|
|
|
|
my $rvalue = Venus::Array->new; |
1940
|
|
|
|
|
|
|
|
1941
|
|
|
|
|
|
|
my $result = $lvalue->le($rvalue); |
1942
|
|
|
|
|
|
|
|
1943
|
|
|
|
|
|
|
# 1 |
1944
|
|
|
|
|
|
|
|
1945
|
|
|
|
|
|
|
=back |
1946
|
|
|
|
|
|
|
|
1947
|
|
|
|
|
|
|
=over 4 |
1948
|
|
|
|
|
|
|
|
1949
|
|
|
|
|
|
|
=item le example 2 |
1950
|
|
|
|
|
|
|
|
1951
|
|
|
|
|
|
|
package main; |
1952
|
|
|
|
|
|
|
|
1953
|
|
|
|
|
|
|
use Venus::Code; |
1954
|
|
|
|
|
|
|
use Venus::String; |
1955
|
|
|
|
|
|
|
|
1956
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1957
|
|
|
|
|
|
|
my $rvalue = Venus::Code->new; |
1958
|
|
|
|
|
|
|
|
1959
|
|
|
|
|
|
|
my $result = $lvalue->le($rvalue); |
1960
|
|
|
|
|
|
|
|
1961
|
|
|
|
|
|
|
# 1 |
1962
|
|
|
|
|
|
|
|
1963
|
|
|
|
|
|
|
=back |
1964
|
|
|
|
|
|
|
|
1965
|
|
|
|
|
|
|
=over 4 |
1966
|
|
|
|
|
|
|
|
1967
|
|
|
|
|
|
|
=item le example 3 |
1968
|
|
|
|
|
|
|
|
1969
|
|
|
|
|
|
|
package main; |
1970
|
|
|
|
|
|
|
|
1971
|
|
|
|
|
|
|
use Venus::Float; |
1972
|
|
|
|
|
|
|
use Venus::String; |
1973
|
|
|
|
|
|
|
|
1974
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1975
|
|
|
|
|
|
|
my $rvalue = Venus::Float->new; |
1976
|
|
|
|
|
|
|
|
1977
|
|
|
|
|
|
|
my $result = $lvalue->le($rvalue); |
1978
|
|
|
|
|
|
|
|
1979
|
|
|
|
|
|
|
# 1 |
1980
|
|
|
|
|
|
|
|
1981
|
|
|
|
|
|
|
=back |
1982
|
|
|
|
|
|
|
|
1983
|
|
|
|
|
|
|
=over 4 |
1984
|
|
|
|
|
|
|
|
1985
|
|
|
|
|
|
|
=item le example 4 |
1986
|
|
|
|
|
|
|
|
1987
|
|
|
|
|
|
|
package main; |
1988
|
|
|
|
|
|
|
|
1989
|
|
|
|
|
|
|
use Venus::Hash; |
1990
|
|
|
|
|
|
|
use Venus::String; |
1991
|
|
|
|
|
|
|
|
1992
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
1993
|
|
|
|
|
|
|
my $rvalue = Venus::Hash->new; |
1994
|
|
|
|
|
|
|
|
1995
|
|
|
|
|
|
|
my $result = $lvalue->le($rvalue); |
1996
|
|
|
|
|
|
|
|
1997
|
|
|
|
|
|
|
# 1 |
1998
|
|
|
|
|
|
|
|
1999
|
|
|
|
|
|
|
=back |
2000
|
|
|
|
|
|
|
|
2001
|
|
|
|
|
|
|
=over 4 |
2002
|
|
|
|
|
|
|
|
2003
|
|
|
|
|
|
|
=item le example 5 |
2004
|
|
|
|
|
|
|
|
2005
|
|
|
|
|
|
|
package main; |
2006
|
|
|
|
|
|
|
|
2007
|
|
|
|
|
|
|
use Venus::Number; |
2008
|
|
|
|
|
|
|
use Venus::String; |
2009
|
|
|
|
|
|
|
|
2010
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2011
|
|
|
|
|
|
|
my $rvalue = Venus::Number->new; |
2012
|
|
|
|
|
|
|
|
2013
|
|
|
|
|
|
|
my $result = $lvalue->le($rvalue); |
2014
|
|
|
|
|
|
|
|
2015
|
|
|
|
|
|
|
# 1 |
2016
|
|
|
|
|
|
|
|
2017
|
|
|
|
|
|
|
=back |
2018
|
|
|
|
|
|
|
|
2019
|
|
|
|
|
|
|
=over 4 |
2020
|
|
|
|
|
|
|
|
2021
|
|
|
|
|
|
|
=item le example 6 |
2022
|
|
|
|
|
|
|
|
2023
|
|
|
|
|
|
|
package main; |
2024
|
|
|
|
|
|
|
|
2025
|
|
|
|
|
|
|
use Venus::Regexp; |
2026
|
|
|
|
|
|
|
use Venus::String; |
2027
|
|
|
|
|
|
|
|
2028
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2029
|
|
|
|
|
|
|
my $rvalue = Venus::Regexp->new; |
2030
|
|
|
|
|
|
|
|
2031
|
|
|
|
|
|
|
my $result = $lvalue->le($rvalue); |
2032
|
|
|
|
|
|
|
|
2033
|
|
|
|
|
|
|
# 1 |
2034
|
|
|
|
|
|
|
|
2035
|
|
|
|
|
|
|
=back |
2036
|
|
|
|
|
|
|
|
2037
|
|
|
|
|
|
|
=over 4 |
2038
|
|
|
|
|
|
|
|
2039
|
|
|
|
|
|
|
=item le example 7 |
2040
|
|
|
|
|
|
|
|
2041
|
|
|
|
|
|
|
package main; |
2042
|
|
|
|
|
|
|
|
2043
|
|
|
|
|
|
|
use Venus::Scalar; |
2044
|
|
|
|
|
|
|
use Venus::String; |
2045
|
|
|
|
|
|
|
|
2046
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2047
|
|
|
|
|
|
|
my $rvalue = Venus::Scalar->new; |
2048
|
|
|
|
|
|
|
|
2049
|
|
|
|
|
|
|
my $result = $lvalue->le($rvalue); |
2050
|
|
|
|
|
|
|
|
2051
|
|
|
|
|
|
|
# 1 |
2052
|
|
|
|
|
|
|
|
2053
|
|
|
|
|
|
|
=back |
2054
|
|
|
|
|
|
|
|
2055
|
|
|
|
|
|
|
=over 4 |
2056
|
|
|
|
|
|
|
|
2057
|
|
|
|
|
|
|
=item le example 8 |
2058
|
|
|
|
|
|
|
|
2059
|
|
|
|
|
|
|
package main; |
2060
|
|
|
|
|
|
|
|
2061
|
|
|
|
|
|
|
use Venus::String; |
2062
|
|
|
|
|
|
|
|
2063
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2064
|
|
|
|
|
|
|
my $rvalue = Venus::String->new; |
2065
|
|
|
|
|
|
|
|
2066
|
|
|
|
|
|
|
my $result = $lvalue->le($rvalue); |
2067
|
|
|
|
|
|
|
|
2068
|
|
|
|
|
|
|
# 1 |
2069
|
|
|
|
|
|
|
|
2070
|
|
|
|
|
|
|
=back |
2071
|
|
|
|
|
|
|
|
2072
|
|
|
|
|
|
|
=over 4 |
2073
|
|
|
|
|
|
|
|
2074
|
|
|
|
|
|
|
=item le example 9 |
2075
|
|
|
|
|
|
|
|
2076
|
|
|
|
|
|
|
package main; |
2077
|
|
|
|
|
|
|
|
2078
|
|
|
|
|
|
|
use Venus::String; |
2079
|
|
|
|
|
|
|
use Venus::Undef; |
2080
|
|
|
|
|
|
|
|
2081
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2082
|
|
|
|
|
|
|
my $rvalue = Venus::Undef->new; |
2083
|
|
|
|
|
|
|
|
2084
|
|
|
|
|
|
|
my $result = $lvalue->le($rvalue); |
2085
|
|
|
|
|
|
|
|
2086
|
|
|
|
|
|
|
# 1 |
2087
|
|
|
|
|
|
|
|
2088
|
|
|
|
|
|
|
=back |
2089
|
|
|
|
|
|
|
|
2090
|
|
|
|
|
|
|
=cut |
2091
|
|
|
|
|
|
|
|
2092
|
|
|
|
|
|
|
=head2 length |
2093
|
|
|
|
|
|
|
|
2094
|
|
|
|
|
|
|
length() (Int) |
2095
|
|
|
|
|
|
|
|
2096
|
|
|
|
|
|
|
The length method returns the number of characters within the string. |
2097
|
|
|
|
|
|
|
|
2098
|
|
|
|
|
|
|
I> |
2099
|
|
|
|
|
|
|
|
2100
|
|
|
|
|
|
|
=over 4 |
2101
|
|
|
|
|
|
|
|
2102
|
|
|
|
|
|
|
=item length example 1 |
2103
|
|
|
|
|
|
|
|
2104
|
|
|
|
|
|
|
# given: synopsis; |
2105
|
|
|
|
|
|
|
|
2106
|
|
|
|
|
|
|
my $length = $string->length; |
2107
|
|
|
|
|
|
|
|
2108
|
|
|
|
|
|
|
# 11 |
2109
|
|
|
|
|
|
|
|
2110
|
|
|
|
|
|
|
=back |
2111
|
|
|
|
|
|
|
|
2112
|
|
|
|
|
|
|
=cut |
2113
|
|
|
|
|
|
|
|
2114
|
|
|
|
|
|
|
=head2 lines |
2115
|
|
|
|
|
|
|
|
2116
|
|
|
|
|
|
|
lines() (ArrayRef[Str]) |
2117
|
|
|
|
|
|
|
|
2118
|
|
|
|
|
|
|
The lines method returns an arrayref of parts by splitting on 1 or more newline |
2119
|
|
|
|
|
|
|
characters. |
2120
|
|
|
|
|
|
|
|
2121
|
|
|
|
|
|
|
I> |
2122
|
|
|
|
|
|
|
|
2123
|
|
|
|
|
|
|
=over 4 |
2124
|
|
|
|
|
|
|
|
2125
|
|
|
|
|
|
|
=item lines example 1 |
2126
|
|
|
|
|
|
|
|
2127
|
|
|
|
|
|
|
# given: synopsis; |
2128
|
|
|
|
|
|
|
|
2129
|
|
|
|
|
|
|
my $lines = $string->lines; |
2130
|
|
|
|
|
|
|
|
2131
|
|
|
|
|
|
|
# ["hello world"] |
2132
|
|
|
|
|
|
|
|
2133
|
|
|
|
|
|
|
=back |
2134
|
|
|
|
|
|
|
|
2135
|
|
|
|
|
|
|
=over 4 |
2136
|
|
|
|
|
|
|
|
2137
|
|
|
|
|
|
|
=item lines example 2 |
2138
|
|
|
|
|
|
|
|
2139
|
|
|
|
|
|
|
package main; |
2140
|
|
|
|
|
|
|
|
2141
|
|
|
|
|
|
|
use Venus::String; |
2142
|
|
|
|
|
|
|
|
2143
|
|
|
|
|
|
|
my $string = Venus::String->new("who am i?\nwhere am i?\nhow did I get here"); |
2144
|
|
|
|
|
|
|
|
2145
|
|
|
|
|
|
|
my $lines = $string->lines; |
2146
|
|
|
|
|
|
|
|
2147
|
|
|
|
|
|
|
# ["who am i?", "where am i?", "how did I get here"] |
2148
|
|
|
|
|
|
|
|
2149
|
|
|
|
|
|
|
=back |
2150
|
|
|
|
|
|
|
|
2151
|
|
|
|
|
|
|
=cut |
2152
|
|
|
|
|
|
|
|
2153
|
|
|
|
|
|
|
=head2 lowercase |
2154
|
|
|
|
|
|
|
|
2155
|
|
|
|
|
|
|
lowercase() (Str) |
2156
|
|
|
|
|
|
|
|
2157
|
|
|
|
|
|
|
The lowercase method is an alias to the lc method. |
2158
|
|
|
|
|
|
|
|
2159
|
|
|
|
|
|
|
I> |
2160
|
|
|
|
|
|
|
|
2161
|
|
|
|
|
|
|
=over 4 |
2162
|
|
|
|
|
|
|
|
2163
|
|
|
|
|
|
|
=item lowercase example 1 |
2164
|
|
|
|
|
|
|
|
2165
|
|
|
|
|
|
|
package main; |
2166
|
|
|
|
|
|
|
|
2167
|
|
|
|
|
|
|
use Venus::String; |
2168
|
|
|
|
|
|
|
|
2169
|
|
|
|
|
|
|
my $string = Venus::String->new('Hello World'); |
2170
|
|
|
|
|
|
|
|
2171
|
|
|
|
|
|
|
my $lowercase = $string->lowercase; |
2172
|
|
|
|
|
|
|
|
2173
|
|
|
|
|
|
|
# "hello world" |
2174
|
|
|
|
|
|
|
|
2175
|
|
|
|
|
|
|
=back |
2176
|
|
|
|
|
|
|
|
2177
|
|
|
|
|
|
|
=cut |
2178
|
|
|
|
|
|
|
|
2179
|
|
|
|
|
|
|
=head2 lt |
2180
|
|
|
|
|
|
|
|
2181
|
|
|
|
|
|
|
lt(Any $arg) (Bool) |
2182
|
|
|
|
|
|
|
|
2183
|
|
|
|
|
|
|
The lt method performs a I<"lesser-than"> operation using the argument provided. |
2184
|
|
|
|
|
|
|
|
2185
|
|
|
|
|
|
|
I> |
2186
|
|
|
|
|
|
|
|
2187
|
|
|
|
|
|
|
=over 4 |
2188
|
|
|
|
|
|
|
|
2189
|
|
|
|
|
|
|
=item lt example 1 |
2190
|
|
|
|
|
|
|
|
2191
|
|
|
|
|
|
|
package main; |
2192
|
|
|
|
|
|
|
|
2193
|
|
|
|
|
|
|
use Venus::Array; |
2194
|
|
|
|
|
|
|
use Venus::String; |
2195
|
|
|
|
|
|
|
|
2196
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2197
|
|
|
|
|
|
|
my $rvalue = Venus::Array->new; |
2198
|
|
|
|
|
|
|
|
2199
|
|
|
|
|
|
|
my $result = $lvalue->lt($rvalue); |
2200
|
|
|
|
|
|
|
|
2201
|
|
|
|
|
|
|
# 1 |
2202
|
|
|
|
|
|
|
|
2203
|
|
|
|
|
|
|
=back |
2204
|
|
|
|
|
|
|
|
2205
|
|
|
|
|
|
|
=over 4 |
2206
|
|
|
|
|
|
|
|
2207
|
|
|
|
|
|
|
=item lt example 2 |
2208
|
|
|
|
|
|
|
|
2209
|
|
|
|
|
|
|
package main; |
2210
|
|
|
|
|
|
|
|
2211
|
|
|
|
|
|
|
use Venus::Code; |
2212
|
|
|
|
|
|
|
use Venus::String; |
2213
|
|
|
|
|
|
|
|
2214
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2215
|
|
|
|
|
|
|
my $rvalue = Venus::Code->new; |
2216
|
|
|
|
|
|
|
|
2217
|
|
|
|
|
|
|
my $result = $lvalue->lt($rvalue); |
2218
|
|
|
|
|
|
|
|
2219
|
|
|
|
|
|
|
# 1 |
2220
|
|
|
|
|
|
|
|
2221
|
|
|
|
|
|
|
=back |
2222
|
|
|
|
|
|
|
|
2223
|
|
|
|
|
|
|
=over 4 |
2224
|
|
|
|
|
|
|
|
2225
|
|
|
|
|
|
|
=item lt example 3 |
2226
|
|
|
|
|
|
|
|
2227
|
|
|
|
|
|
|
package main; |
2228
|
|
|
|
|
|
|
|
2229
|
|
|
|
|
|
|
use Venus::Float; |
2230
|
|
|
|
|
|
|
use Venus::String; |
2231
|
|
|
|
|
|
|
|
2232
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2233
|
|
|
|
|
|
|
my $rvalue = Venus::Float->new; |
2234
|
|
|
|
|
|
|
|
2235
|
|
|
|
|
|
|
my $result = $lvalue->lt($rvalue); |
2236
|
|
|
|
|
|
|
|
2237
|
|
|
|
|
|
|
# 1 |
2238
|
|
|
|
|
|
|
|
2239
|
|
|
|
|
|
|
=back |
2240
|
|
|
|
|
|
|
|
2241
|
|
|
|
|
|
|
=over 4 |
2242
|
|
|
|
|
|
|
|
2243
|
|
|
|
|
|
|
=item lt example 4 |
2244
|
|
|
|
|
|
|
|
2245
|
|
|
|
|
|
|
package main; |
2246
|
|
|
|
|
|
|
|
2247
|
|
|
|
|
|
|
use Venus::Hash; |
2248
|
|
|
|
|
|
|
use Venus::String; |
2249
|
|
|
|
|
|
|
|
2250
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2251
|
|
|
|
|
|
|
my $rvalue = Venus::Hash->new; |
2252
|
|
|
|
|
|
|
|
2253
|
|
|
|
|
|
|
my $result = $lvalue->lt($rvalue); |
2254
|
|
|
|
|
|
|
|
2255
|
|
|
|
|
|
|
# 1 |
2256
|
|
|
|
|
|
|
|
2257
|
|
|
|
|
|
|
=back |
2258
|
|
|
|
|
|
|
|
2259
|
|
|
|
|
|
|
=over 4 |
2260
|
|
|
|
|
|
|
|
2261
|
|
|
|
|
|
|
=item lt example 5 |
2262
|
|
|
|
|
|
|
|
2263
|
|
|
|
|
|
|
package main; |
2264
|
|
|
|
|
|
|
|
2265
|
|
|
|
|
|
|
use Venus::Number; |
2266
|
|
|
|
|
|
|
use Venus::String; |
2267
|
|
|
|
|
|
|
|
2268
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2269
|
|
|
|
|
|
|
my $rvalue = Venus::Number->new; |
2270
|
|
|
|
|
|
|
|
2271
|
|
|
|
|
|
|
my $result = $lvalue->lt($rvalue); |
2272
|
|
|
|
|
|
|
|
2273
|
|
|
|
|
|
|
# 1 |
2274
|
|
|
|
|
|
|
|
2275
|
|
|
|
|
|
|
=back |
2276
|
|
|
|
|
|
|
|
2277
|
|
|
|
|
|
|
=over 4 |
2278
|
|
|
|
|
|
|
|
2279
|
|
|
|
|
|
|
=item lt example 6 |
2280
|
|
|
|
|
|
|
|
2281
|
|
|
|
|
|
|
package main; |
2282
|
|
|
|
|
|
|
|
2283
|
|
|
|
|
|
|
use Venus::Regexp; |
2284
|
|
|
|
|
|
|
use Venus::String; |
2285
|
|
|
|
|
|
|
|
2286
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2287
|
|
|
|
|
|
|
my $rvalue = Venus::Regexp->new; |
2288
|
|
|
|
|
|
|
|
2289
|
|
|
|
|
|
|
my $result = $lvalue->lt($rvalue); |
2290
|
|
|
|
|
|
|
|
2291
|
|
|
|
|
|
|
# 1 |
2292
|
|
|
|
|
|
|
|
2293
|
|
|
|
|
|
|
=back |
2294
|
|
|
|
|
|
|
|
2295
|
|
|
|
|
|
|
=over 4 |
2296
|
|
|
|
|
|
|
|
2297
|
|
|
|
|
|
|
=item lt example 7 |
2298
|
|
|
|
|
|
|
|
2299
|
|
|
|
|
|
|
package main; |
2300
|
|
|
|
|
|
|
|
2301
|
|
|
|
|
|
|
use Venus::Scalar; |
2302
|
|
|
|
|
|
|
use Venus::String; |
2303
|
|
|
|
|
|
|
|
2304
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2305
|
|
|
|
|
|
|
my $rvalue = Venus::Scalar->new; |
2306
|
|
|
|
|
|
|
|
2307
|
|
|
|
|
|
|
my $result = $lvalue->lt($rvalue); |
2308
|
|
|
|
|
|
|
|
2309
|
|
|
|
|
|
|
# 1 |
2310
|
|
|
|
|
|
|
|
2311
|
|
|
|
|
|
|
=back |
2312
|
|
|
|
|
|
|
|
2313
|
|
|
|
|
|
|
=over 4 |
2314
|
|
|
|
|
|
|
|
2315
|
|
|
|
|
|
|
=item lt example 8 |
2316
|
|
|
|
|
|
|
|
2317
|
|
|
|
|
|
|
package main; |
2318
|
|
|
|
|
|
|
|
2319
|
|
|
|
|
|
|
use Venus::String; |
2320
|
|
|
|
|
|
|
|
2321
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2322
|
|
|
|
|
|
|
my $rvalue = Venus::String->new; |
2323
|
|
|
|
|
|
|
|
2324
|
|
|
|
|
|
|
my $result = $lvalue->lt($rvalue); |
2325
|
|
|
|
|
|
|
|
2326
|
|
|
|
|
|
|
# 0 |
2327
|
|
|
|
|
|
|
|
2328
|
|
|
|
|
|
|
=back |
2329
|
|
|
|
|
|
|
|
2330
|
|
|
|
|
|
|
=over 4 |
2331
|
|
|
|
|
|
|
|
2332
|
|
|
|
|
|
|
=item lt example 9 |
2333
|
|
|
|
|
|
|
|
2334
|
|
|
|
|
|
|
package main; |
2335
|
|
|
|
|
|
|
|
2336
|
|
|
|
|
|
|
use Venus::String; |
2337
|
|
|
|
|
|
|
use Venus::Undef; |
2338
|
|
|
|
|
|
|
|
2339
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2340
|
|
|
|
|
|
|
my $rvalue = Venus::Undef->new; |
2341
|
|
|
|
|
|
|
|
2342
|
|
|
|
|
|
|
my $result = $lvalue->lt($rvalue); |
2343
|
|
|
|
|
|
|
|
2344
|
|
|
|
|
|
|
# 0 |
2345
|
|
|
|
|
|
|
|
2346
|
|
|
|
|
|
|
=back |
2347
|
|
|
|
|
|
|
|
2348
|
|
|
|
|
|
|
=cut |
2349
|
|
|
|
|
|
|
|
2350
|
|
|
|
|
|
|
=head2 ne |
2351
|
|
|
|
|
|
|
|
2352
|
|
|
|
|
|
|
ne(Any $arg) (Bool) |
2353
|
|
|
|
|
|
|
|
2354
|
|
|
|
|
|
|
The ne method performs a I<"not-equal-to"> operation using the argument provided. |
2355
|
|
|
|
|
|
|
|
2356
|
|
|
|
|
|
|
I> |
2357
|
|
|
|
|
|
|
|
2358
|
|
|
|
|
|
|
=over 4 |
2359
|
|
|
|
|
|
|
|
2360
|
|
|
|
|
|
|
=item ne example 1 |
2361
|
|
|
|
|
|
|
|
2362
|
|
|
|
|
|
|
package main; |
2363
|
|
|
|
|
|
|
|
2364
|
|
|
|
|
|
|
use Venus::Array; |
2365
|
|
|
|
|
|
|
use Venus::String; |
2366
|
|
|
|
|
|
|
|
2367
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2368
|
|
|
|
|
|
|
my $rvalue = Venus::Array->new; |
2369
|
|
|
|
|
|
|
|
2370
|
|
|
|
|
|
|
my $result = $lvalue->ne($rvalue); |
2371
|
|
|
|
|
|
|
|
2372
|
|
|
|
|
|
|
# 1 |
2373
|
|
|
|
|
|
|
|
2374
|
|
|
|
|
|
|
=back |
2375
|
|
|
|
|
|
|
|
2376
|
|
|
|
|
|
|
=over 4 |
2377
|
|
|
|
|
|
|
|
2378
|
|
|
|
|
|
|
=item ne example 2 |
2379
|
|
|
|
|
|
|
|
2380
|
|
|
|
|
|
|
package main; |
2381
|
|
|
|
|
|
|
|
2382
|
|
|
|
|
|
|
use Venus::Code; |
2383
|
|
|
|
|
|
|
use Venus::String; |
2384
|
|
|
|
|
|
|
|
2385
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2386
|
|
|
|
|
|
|
my $rvalue = Venus::Code->new; |
2387
|
|
|
|
|
|
|
|
2388
|
|
|
|
|
|
|
my $result = $lvalue->ne($rvalue); |
2389
|
|
|
|
|
|
|
|
2390
|
|
|
|
|
|
|
# 1 |
2391
|
|
|
|
|
|
|
|
2392
|
|
|
|
|
|
|
=back |
2393
|
|
|
|
|
|
|
|
2394
|
|
|
|
|
|
|
=over 4 |
2395
|
|
|
|
|
|
|
|
2396
|
|
|
|
|
|
|
=item ne example 3 |
2397
|
|
|
|
|
|
|
|
2398
|
|
|
|
|
|
|
package main; |
2399
|
|
|
|
|
|
|
|
2400
|
|
|
|
|
|
|
use Venus::Float; |
2401
|
|
|
|
|
|
|
use Venus::String; |
2402
|
|
|
|
|
|
|
|
2403
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2404
|
|
|
|
|
|
|
my $rvalue = Venus::Float->new; |
2405
|
|
|
|
|
|
|
|
2406
|
|
|
|
|
|
|
my $result = $lvalue->ne($rvalue); |
2407
|
|
|
|
|
|
|
|
2408
|
|
|
|
|
|
|
# 1 |
2409
|
|
|
|
|
|
|
|
2410
|
|
|
|
|
|
|
=back |
2411
|
|
|
|
|
|
|
|
2412
|
|
|
|
|
|
|
=over 4 |
2413
|
|
|
|
|
|
|
|
2414
|
|
|
|
|
|
|
=item ne example 4 |
2415
|
|
|
|
|
|
|
|
2416
|
|
|
|
|
|
|
package main; |
2417
|
|
|
|
|
|
|
|
2418
|
|
|
|
|
|
|
use Venus::Hash; |
2419
|
|
|
|
|
|
|
use Venus::String; |
2420
|
|
|
|
|
|
|
|
2421
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2422
|
|
|
|
|
|
|
my $rvalue = Venus::Hash->new; |
2423
|
|
|
|
|
|
|
|
2424
|
|
|
|
|
|
|
my $result = $lvalue->ne($rvalue); |
2425
|
|
|
|
|
|
|
|
2426
|
|
|
|
|
|
|
# 1 |
2427
|
|
|
|
|
|
|
|
2428
|
|
|
|
|
|
|
=back |
2429
|
|
|
|
|
|
|
|
2430
|
|
|
|
|
|
|
=over 4 |
2431
|
|
|
|
|
|
|
|
2432
|
|
|
|
|
|
|
=item ne example 5 |
2433
|
|
|
|
|
|
|
|
2434
|
|
|
|
|
|
|
package main; |
2435
|
|
|
|
|
|
|
|
2436
|
|
|
|
|
|
|
use Venus::Number; |
2437
|
|
|
|
|
|
|
use Venus::String; |
2438
|
|
|
|
|
|
|
|
2439
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2440
|
|
|
|
|
|
|
my $rvalue = Venus::Number->new; |
2441
|
|
|
|
|
|
|
|
2442
|
|
|
|
|
|
|
my $result = $lvalue->ne($rvalue); |
2443
|
|
|
|
|
|
|
|
2444
|
|
|
|
|
|
|
# 1 |
2445
|
|
|
|
|
|
|
|
2446
|
|
|
|
|
|
|
=back |
2447
|
|
|
|
|
|
|
|
2448
|
|
|
|
|
|
|
=over 4 |
2449
|
|
|
|
|
|
|
|
2450
|
|
|
|
|
|
|
=item ne example 6 |
2451
|
|
|
|
|
|
|
|
2452
|
|
|
|
|
|
|
package main; |
2453
|
|
|
|
|
|
|
|
2454
|
|
|
|
|
|
|
use Venus::Regexp; |
2455
|
|
|
|
|
|
|
use Venus::String; |
2456
|
|
|
|
|
|
|
|
2457
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2458
|
|
|
|
|
|
|
my $rvalue = Venus::Regexp->new; |
2459
|
|
|
|
|
|
|
|
2460
|
|
|
|
|
|
|
my $result = $lvalue->ne($rvalue); |
2461
|
|
|
|
|
|
|
|
2462
|
|
|
|
|
|
|
# 1 |
2463
|
|
|
|
|
|
|
|
2464
|
|
|
|
|
|
|
=back |
2465
|
|
|
|
|
|
|
|
2466
|
|
|
|
|
|
|
=over 4 |
2467
|
|
|
|
|
|
|
|
2468
|
|
|
|
|
|
|
=item ne example 7 |
2469
|
|
|
|
|
|
|
|
2470
|
|
|
|
|
|
|
package main; |
2471
|
|
|
|
|
|
|
|
2472
|
|
|
|
|
|
|
use Venus::Scalar; |
2473
|
|
|
|
|
|
|
use Venus::String; |
2474
|
|
|
|
|
|
|
|
2475
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2476
|
|
|
|
|
|
|
my $rvalue = Venus::Scalar->new; |
2477
|
|
|
|
|
|
|
|
2478
|
|
|
|
|
|
|
my $result = $lvalue->ne($rvalue); |
2479
|
|
|
|
|
|
|
|
2480
|
|
|
|
|
|
|
# 1 |
2481
|
|
|
|
|
|
|
|
2482
|
|
|
|
|
|
|
=back |
2483
|
|
|
|
|
|
|
|
2484
|
|
|
|
|
|
|
=over 4 |
2485
|
|
|
|
|
|
|
|
2486
|
|
|
|
|
|
|
=item ne example 8 |
2487
|
|
|
|
|
|
|
|
2488
|
|
|
|
|
|
|
package main; |
2489
|
|
|
|
|
|
|
|
2490
|
|
|
|
|
|
|
use Venus::String; |
2491
|
|
|
|
|
|
|
|
2492
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2493
|
|
|
|
|
|
|
my $rvalue = Venus::String->new; |
2494
|
|
|
|
|
|
|
|
2495
|
|
|
|
|
|
|
my $result = $lvalue->ne($rvalue); |
2496
|
|
|
|
|
|
|
|
2497
|
|
|
|
|
|
|
# 0 |
2498
|
|
|
|
|
|
|
|
2499
|
|
|
|
|
|
|
=back |
2500
|
|
|
|
|
|
|
|
2501
|
|
|
|
|
|
|
=over 4 |
2502
|
|
|
|
|
|
|
|
2503
|
|
|
|
|
|
|
=item ne example 9 |
2504
|
|
|
|
|
|
|
|
2505
|
|
|
|
|
|
|
package main; |
2506
|
|
|
|
|
|
|
|
2507
|
|
|
|
|
|
|
use Venus::String; |
2508
|
|
|
|
|
|
|
use Venus::Undef; |
2509
|
|
|
|
|
|
|
|
2510
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
2511
|
|
|
|
|
|
|
my $rvalue = Venus::Undef->new; |
2512
|
|
|
|
|
|
|
|
2513
|
|
|
|
|
|
|
my $result = $lvalue->ne($rvalue); |
2514
|
|
|
|
|
|
|
|
2515
|
|
|
|
|
|
|
# 0 |
2516
|
|
|
|
|
|
|
|
2517
|
|
|
|
|
|
|
=back |
2518
|
|
|
|
|
|
|
|
2519
|
|
|
|
|
|
|
=cut |
2520
|
|
|
|
|
|
|
|
2521
|
|
|
|
|
|
|
=head2 numified |
2522
|
|
|
|
|
|
|
|
2523
|
|
|
|
|
|
|
numified() (Int) |
2524
|
|
|
|
|
|
|
|
2525
|
|
|
|
|
|
|
The numified method returns the numerical representation of the object. For |
2526
|
|
|
|
|
|
|
string objects this method returns the underlying value, if that value looks |
2527
|
|
|
|
|
|
|
like a number, or C<0>. |
2528
|
|
|
|
|
|
|
|
2529
|
|
|
|
|
|
|
I> |
2530
|
|
|
|
|
|
|
|
2531
|
|
|
|
|
|
|
=over 4 |
2532
|
|
|
|
|
|
|
|
2533
|
|
|
|
|
|
|
=item numified example 1 |
2534
|
|
|
|
|
|
|
|
2535
|
|
|
|
|
|
|
# given: synopsis; |
2536
|
|
|
|
|
|
|
|
2537
|
|
|
|
|
|
|
my $numified = $string->numified; |
2538
|
|
|
|
|
|
|
|
2539
|
|
|
|
|
|
|
# 11 |
2540
|
|
|
|
|
|
|
|
2541
|
|
|
|
|
|
|
=back |
2542
|
|
|
|
|
|
|
|
2543
|
|
|
|
|
|
|
=over 4 |
2544
|
|
|
|
|
|
|
|
2545
|
|
|
|
|
|
|
=item numified example 2 |
2546
|
|
|
|
|
|
|
|
2547
|
|
|
|
|
|
|
package main; |
2548
|
|
|
|
|
|
|
|
2549
|
|
|
|
|
|
|
use Venus::String; |
2550
|
|
|
|
|
|
|
|
2551
|
|
|
|
|
|
|
my $string = Venus::String->new(1_000_000); |
2552
|
|
|
|
|
|
|
|
2553
|
|
|
|
|
|
|
my $numified = $string->numified; |
2554
|
|
|
|
|
|
|
|
2555
|
|
|
|
|
|
|
# 1000000 |
2556
|
|
|
|
|
|
|
|
2557
|
|
|
|
|
|
|
=back |
2558
|
|
|
|
|
|
|
|
2559
|
|
|
|
|
|
|
=cut |
2560
|
|
|
|
|
|
|
|
2561
|
|
|
|
|
|
|
=head2 pascalcase |
2562
|
|
|
|
|
|
|
|
2563
|
|
|
|
|
|
|
pascalcase() (Str) |
2564
|
|
|
|
|
|
|
|
2565
|
|
|
|
|
|
|
The pascalcase method converts the string to pascalcase. |
2566
|
|
|
|
|
|
|
|
2567
|
|
|
|
|
|
|
I> |
2568
|
|
|
|
|
|
|
|
2569
|
|
|
|
|
|
|
=over 4 |
2570
|
|
|
|
|
|
|
|
2571
|
|
|
|
|
|
|
=item pascalcase example 1 |
2572
|
|
|
|
|
|
|
|
2573
|
|
|
|
|
|
|
# given: synopsis; |
2574
|
|
|
|
|
|
|
|
2575
|
|
|
|
|
|
|
my $pascalcase = $string->pascalcase; |
2576
|
|
|
|
|
|
|
|
2577
|
|
|
|
|
|
|
# "HelloWorld" |
2578
|
|
|
|
|
|
|
|
2579
|
|
|
|
|
|
|
=back |
2580
|
|
|
|
|
|
|
|
2581
|
|
|
|
|
|
|
=cut |
2582
|
|
|
|
|
|
|
|
2583
|
|
|
|
|
|
|
=head2 prepend |
2584
|
|
|
|
|
|
|
|
2585
|
|
|
|
|
|
|
prepend(Str @parts) (Str) |
2586
|
|
|
|
|
|
|
|
2587
|
|
|
|
|
|
|
The prepend method prepends arugments to the string using spaces. |
2588
|
|
|
|
|
|
|
|
2589
|
|
|
|
|
|
|
I> |
2590
|
|
|
|
|
|
|
|
2591
|
|
|
|
|
|
|
=over 4 |
2592
|
|
|
|
|
|
|
|
2593
|
|
|
|
|
|
|
=item prepend example 1 |
2594
|
|
|
|
|
|
|
|
2595
|
|
|
|
|
|
|
# given: synopsis; |
2596
|
|
|
|
|
|
|
|
2597
|
|
|
|
|
|
|
my $prepend = $string->prepend('welcome'); |
2598
|
|
|
|
|
|
|
|
2599
|
|
|
|
|
|
|
# "welcome hello world" |
2600
|
|
|
|
|
|
|
|
2601
|
|
|
|
|
|
|
=back |
2602
|
|
|
|
|
|
|
|
2603
|
|
|
|
|
|
|
=cut |
2604
|
|
|
|
|
|
|
|
2605
|
|
|
|
|
|
|
=head2 prepend_with |
2606
|
|
|
|
|
|
|
|
2607
|
|
|
|
|
|
|
prepend_with(Str $delimiter, Str @parts) (Str) |
2608
|
|
|
|
|
|
|
|
2609
|
|
|
|
|
|
|
The prepend_with method prepends arugments to the string using the delimiter |
2610
|
|
|
|
|
|
|
provided. |
2611
|
|
|
|
|
|
|
|
2612
|
|
|
|
|
|
|
I> |
2613
|
|
|
|
|
|
|
|
2614
|
|
|
|
|
|
|
=over 4 |
2615
|
|
|
|
|
|
|
|
2616
|
|
|
|
|
|
|
=item prepend_with example 1 |
2617
|
|
|
|
|
|
|
|
2618
|
|
|
|
|
|
|
# given: synopsis; |
2619
|
|
|
|
|
|
|
|
2620
|
|
|
|
|
|
|
my $prepend = $string->prepend_with(', ', 'welcome'); |
2621
|
|
|
|
|
|
|
|
2622
|
|
|
|
|
|
|
# "welcome, hello world" |
2623
|
|
|
|
|
|
|
|
2624
|
|
|
|
|
|
|
=back |
2625
|
|
|
|
|
|
|
|
2626
|
|
|
|
|
|
|
=cut |
2627
|
|
|
|
|
|
|
|
2628
|
|
|
|
|
|
|
=head2 render |
2629
|
|
|
|
|
|
|
|
2630
|
|
|
|
|
|
|
render(HashRef $tokens) (Str) |
2631
|
|
|
|
|
|
|
|
2632
|
|
|
|
|
|
|
The render method treats the string as a template and performs a simple token |
2633
|
|
|
|
|
|
|
replacement using the argument provided. |
2634
|
|
|
|
|
|
|
|
2635
|
|
|
|
|
|
|
I> |
2636
|
|
|
|
|
|
|
|
2637
|
|
|
|
|
|
|
=over 4 |
2638
|
|
|
|
|
|
|
|
2639
|
|
|
|
|
|
|
=item render example 1 |
2640
|
|
|
|
|
|
|
|
2641
|
|
|
|
|
|
|
package main; |
2642
|
|
|
|
|
|
|
|
2643
|
|
|
|
|
|
|
use Venus::String; |
2644
|
|
|
|
|
|
|
|
2645
|
|
|
|
|
|
|
my $string = Venus::String->new('Hi, {{name}}!'); |
2646
|
|
|
|
|
|
|
|
2647
|
|
|
|
|
|
|
my $render = $string->render({name => 'Friend'}); |
2648
|
|
|
|
|
|
|
|
2649
|
|
|
|
|
|
|
# "Hi, Friend!" |
2650
|
|
|
|
|
|
|
|
2651
|
|
|
|
|
|
|
=back |
2652
|
|
|
|
|
|
|
|
2653
|
|
|
|
|
|
|
=cut |
2654
|
|
|
|
|
|
|
|
2655
|
|
|
|
|
|
|
=head2 repeat |
2656
|
|
|
|
|
|
|
|
2657
|
|
|
|
|
|
|
repeat(Num $number, Str $delimiter) (Str) |
2658
|
|
|
|
|
|
|
|
2659
|
|
|
|
|
|
|
The repeat method repeats the string value N times based on the number provided |
2660
|
|
|
|
|
|
|
and returns a new concatenated string. Optionally, a delimiter can be provided |
2661
|
|
|
|
|
|
|
and be place between the occurences. |
2662
|
|
|
|
|
|
|
|
2663
|
|
|
|
|
|
|
I> |
2664
|
|
|
|
|
|
|
|
2665
|
|
|
|
|
|
|
=over 4 |
2666
|
|
|
|
|
|
|
|
2667
|
|
|
|
|
|
|
=item repeat example 1 |
2668
|
|
|
|
|
|
|
|
2669
|
|
|
|
|
|
|
package main; |
2670
|
|
|
|
|
|
|
|
2671
|
|
|
|
|
|
|
use Venus::String; |
2672
|
|
|
|
|
|
|
|
2673
|
|
|
|
|
|
|
my $string = Venus::String->new('999'); |
2674
|
|
|
|
|
|
|
|
2675
|
|
|
|
|
|
|
my $repeat = $string->repeat(2); |
2676
|
|
|
|
|
|
|
|
2677
|
|
|
|
|
|
|
# "999999" |
2678
|
|
|
|
|
|
|
|
2679
|
|
|
|
|
|
|
=back |
2680
|
|
|
|
|
|
|
|
2681
|
|
|
|
|
|
|
=over 4 |
2682
|
|
|
|
|
|
|
|
2683
|
|
|
|
|
|
|
=item repeat example 2 |
2684
|
|
|
|
|
|
|
|
2685
|
|
|
|
|
|
|
package main; |
2686
|
|
|
|
|
|
|
|
2687
|
|
|
|
|
|
|
use Venus::String; |
2688
|
|
|
|
|
|
|
|
2689
|
|
|
|
|
|
|
my $string = Venus::String->new('999'); |
2690
|
|
|
|
|
|
|
|
2691
|
|
|
|
|
|
|
my $repeat = $string->repeat(2, ','); |
2692
|
|
|
|
|
|
|
|
2693
|
|
|
|
|
|
|
# "999,999" |
2694
|
|
|
|
|
|
|
|
2695
|
|
|
|
|
|
|
=back |
2696
|
|
|
|
|
|
|
|
2697
|
|
|
|
|
|
|
=cut |
2698
|
|
|
|
|
|
|
|
2699
|
|
|
|
|
|
|
=head2 replace |
2700
|
|
|
|
|
|
|
|
2701
|
|
|
|
|
|
|
replace(Regexp $regexp, Str $replace, Str $flags) (Replace) |
2702
|
|
|
|
|
|
|
|
2703
|
|
|
|
|
|
|
The replace method performs a search and replace operation and returns the |
2704
|
|
|
|
|
|
|
L object. |
2705
|
|
|
|
|
|
|
|
2706
|
|
|
|
|
|
|
I> |
2707
|
|
|
|
|
|
|
|
2708
|
|
|
|
|
|
|
=over 4 |
2709
|
|
|
|
|
|
|
|
2710
|
|
|
|
|
|
|
=item replace example 1 |
2711
|
|
|
|
|
|
|
|
2712
|
|
|
|
|
|
|
# given: synopsis; |
2713
|
|
|
|
|
|
|
|
2714
|
|
|
|
|
|
|
my $replace = $string->replace('world', 'universe'); |
2715
|
|
|
|
|
|
|
|
2716
|
|
|
|
|
|
|
# bless({ |
2717
|
|
|
|
|
|
|
# ..., |
2718
|
|
|
|
|
|
|
# "flags" => "", |
2719
|
|
|
|
|
|
|
# "regexp" => "world", |
2720
|
|
|
|
|
|
|
# "string" => "hello world", |
2721
|
|
|
|
|
|
|
# "substr" => "universe", |
2722
|
|
|
|
|
|
|
# }, "Venus::Replace") |
2723
|
|
|
|
|
|
|
|
2724
|
|
|
|
|
|
|
=back |
2725
|
|
|
|
|
|
|
|
2726
|
|
|
|
|
|
|
=cut |
2727
|
|
|
|
|
|
|
|
2728
|
|
|
|
|
|
|
=head2 reverse |
2729
|
|
|
|
|
|
|
|
2730
|
|
|
|
|
|
|
reverse() (Str) |
2731
|
|
|
|
|
|
|
|
2732
|
|
|
|
|
|
|
The reverse method returns a string where the characters in the string are in |
2733
|
|
|
|
|
|
|
the opposite order. |
2734
|
|
|
|
|
|
|
|
2735
|
|
|
|
|
|
|
I> |
2736
|
|
|
|
|
|
|
|
2737
|
|
|
|
|
|
|
=over 4 |
2738
|
|
|
|
|
|
|
|
2739
|
|
|
|
|
|
|
=item reverse example 1 |
2740
|
|
|
|
|
|
|
|
2741
|
|
|
|
|
|
|
# given: synopsis; |
2742
|
|
|
|
|
|
|
|
2743
|
|
|
|
|
|
|
my $reverse = $string->reverse; |
2744
|
|
|
|
|
|
|
|
2745
|
|
|
|
|
|
|
# "dlrow olleh" |
2746
|
|
|
|
|
|
|
|
2747
|
|
|
|
|
|
|
=back |
2748
|
|
|
|
|
|
|
|
2749
|
|
|
|
|
|
|
=cut |
2750
|
|
|
|
|
|
|
|
2751
|
|
|
|
|
|
|
=head2 rindex |
2752
|
|
|
|
|
|
|
|
2753
|
|
|
|
|
|
|
rindex(Str $substr, Int $start) (Str) |
2754
|
|
|
|
|
|
|
|
2755
|
|
|
|
|
|
|
The rindex method searches for the argument within the string and returns the |
2756
|
|
|
|
|
|
|
position of the last occurrence of the argument. |
2757
|
|
|
|
|
|
|
|
2758
|
|
|
|
|
|
|
I> |
2759
|
|
|
|
|
|
|
|
2760
|
|
|
|
|
|
|
=over 4 |
2761
|
|
|
|
|
|
|
|
2762
|
|
|
|
|
|
|
=item rindex example 1 |
2763
|
|
|
|
|
|
|
|
2764
|
|
|
|
|
|
|
package main; |
2765
|
|
|
|
|
|
|
|
2766
|
|
|
|
|
|
|
use Venus::String; |
2767
|
|
|
|
|
|
|
|
2768
|
|
|
|
|
|
|
my $string = Venus::String->new('explain the unexplainable'); |
2769
|
|
|
|
|
|
|
|
2770
|
|
|
|
|
|
|
my $rindex = $string->rindex('explain'); |
2771
|
|
|
|
|
|
|
|
2772
|
|
|
|
|
|
|
# 14 |
2773
|
|
|
|
|
|
|
|
2774
|
|
|
|
|
|
|
=back |
2775
|
|
|
|
|
|
|
|
2776
|
|
|
|
|
|
|
=over 4 |
2777
|
|
|
|
|
|
|
|
2778
|
|
|
|
|
|
|
=item rindex example 2 |
2779
|
|
|
|
|
|
|
|
2780
|
|
|
|
|
|
|
package main; |
2781
|
|
|
|
|
|
|
|
2782
|
|
|
|
|
|
|
use Venus::String; |
2783
|
|
|
|
|
|
|
|
2784
|
|
|
|
|
|
|
my $string = Venus::String->new('explain the unexplainable'); |
2785
|
|
|
|
|
|
|
|
2786
|
|
|
|
|
|
|
my $rindex = $string->rindex('explained'); |
2787
|
|
|
|
|
|
|
|
2788
|
|
|
|
|
|
|
# -1 |
2789
|
|
|
|
|
|
|
|
2790
|
|
|
|
|
|
|
=back |
2791
|
|
|
|
|
|
|
|
2792
|
|
|
|
|
|
|
=over 4 |
2793
|
|
|
|
|
|
|
|
2794
|
|
|
|
|
|
|
=item rindex example 3 |
2795
|
|
|
|
|
|
|
|
2796
|
|
|
|
|
|
|
package main; |
2797
|
|
|
|
|
|
|
|
2798
|
|
|
|
|
|
|
use Venus::String; |
2799
|
|
|
|
|
|
|
|
2800
|
|
|
|
|
|
|
my $string = Venus::String->new('explain the unexplainable'); |
2801
|
|
|
|
|
|
|
|
2802
|
|
|
|
|
|
|
my $rindex = $string->rindex('explain', 21); |
2803
|
|
|
|
|
|
|
|
2804
|
|
|
|
|
|
|
# 14 |
2805
|
|
|
|
|
|
|
|
2806
|
|
|
|
|
|
|
=back |
2807
|
|
|
|
|
|
|
|
2808
|
|
|
|
|
|
|
=cut |
2809
|
|
|
|
|
|
|
|
2810
|
|
|
|
|
|
|
=head2 search |
2811
|
|
|
|
|
|
|
|
2812
|
|
|
|
|
|
|
search(Regexp $regexp) (Search) |
2813
|
|
|
|
|
|
|
|
2814
|
|
|
|
|
|
|
The search method performs a search operation and returns the L |
2815
|
|
|
|
|
|
|
object. |
2816
|
|
|
|
|
|
|
|
2817
|
|
|
|
|
|
|
I> |
2818
|
|
|
|
|
|
|
|
2819
|
|
|
|
|
|
|
=over 4 |
2820
|
|
|
|
|
|
|
|
2821
|
|
|
|
|
|
|
=item search example 1 |
2822
|
|
|
|
|
|
|
|
2823
|
|
|
|
|
|
|
# given: synopsis; |
2824
|
|
|
|
|
|
|
|
2825
|
|
|
|
|
|
|
my $search = $string->search('world'); |
2826
|
|
|
|
|
|
|
|
2827
|
|
|
|
|
|
|
# bless({ |
2828
|
|
|
|
|
|
|
# ..., |
2829
|
|
|
|
|
|
|
# "flags" => "", |
2830
|
|
|
|
|
|
|
# "regexp" => "world", |
2831
|
|
|
|
|
|
|
# "string" => "hello world", |
2832
|
|
|
|
|
|
|
# }, "Venus::Search") |
2833
|
|
|
|
|
|
|
|
2834
|
|
|
|
|
|
|
=back |
2835
|
|
|
|
|
|
|
|
2836
|
|
|
|
|
|
|
=cut |
2837
|
|
|
|
|
|
|
|
2838
|
|
|
|
|
|
|
=head2 snakecase |
2839
|
|
|
|
|
|
|
|
2840
|
|
|
|
|
|
|
snakecase() (Str) |
2841
|
|
|
|
|
|
|
|
2842
|
|
|
|
|
|
|
The snakecase method converts the string to snakecase. |
2843
|
|
|
|
|
|
|
|
2844
|
|
|
|
|
|
|
I> |
2845
|
|
|
|
|
|
|
|
2846
|
|
|
|
|
|
|
=over 4 |
2847
|
|
|
|
|
|
|
|
2848
|
|
|
|
|
|
|
=item snakecase example 1 |
2849
|
|
|
|
|
|
|
|
2850
|
|
|
|
|
|
|
# given: synopsis; |
2851
|
|
|
|
|
|
|
|
2852
|
|
|
|
|
|
|
my $snakecase = $string->snakecase; |
2853
|
|
|
|
|
|
|
|
2854
|
|
|
|
|
|
|
# "hello_world" |
2855
|
|
|
|
|
|
|
|
2856
|
|
|
|
|
|
|
=back |
2857
|
|
|
|
|
|
|
|
2858
|
|
|
|
|
|
|
=cut |
2859
|
|
|
|
|
|
|
|
2860
|
|
|
|
|
|
|
=head2 split |
2861
|
|
|
|
|
|
|
|
2862
|
|
|
|
|
|
|
split(Str | Regexp $expr, Maybe[Int] $limit) (ArrayRef) |
2863
|
|
|
|
|
|
|
|
2864
|
|
|
|
|
|
|
The split method returns an arrayref by splitting the string on the argument. |
2865
|
|
|
|
|
|
|
|
2866
|
|
|
|
|
|
|
I> |
2867
|
|
|
|
|
|
|
|
2868
|
|
|
|
|
|
|
=over 4 |
2869
|
|
|
|
|
|
|
|
2870
|
|
|
|
|
|
|
=item split example 1 |
2871
|
|
|
|
|
|
|
|
2872
|
|
|
|
|
|
|
package main; |
2873
|
|
|
|
|
|
|
|
2874
|
|
|
|
|
|
|
use Venus::String; |
2875
|
|
|
|
|
|
|
|
2876
|
|
|
|
|
|
|
my $string = Venus::String->new('name, age, dob, email'); |
2877
|
|
|
|
|
|
|
|
2878
|
|
|
|
|
|
|
my $split = $string->split(', '); |
2879
|
|
|
|
|
|
|
|
2880
|
|
|
|
|
|
|
# ["name", "age", "dob", "email"] |
2881
|
|
|
|
|
|
|
|
2882
|
|
|
|
|
|
|
=back |
2883
|
|
|
|
|
|
|
|
2884
|
|
|
|
|
|
|
=over 4 |
2885
|
|
|
|
|
|
|
|
2886
|
|
|
|
|
|
|
=item split example 2 |
2887
|
|
|
|
|
|
|
|
2888
|
|
|
|
|
|
|
package main; |
2889
|
|
|
|
|
|
|
|
2890
|
|
|
|
|
|
|
use Venus::String; |
2891
|
|
|
|
|
|
|
|
2892
|
|
|
|
|
|
|
my $string = Venus::String->new('name, age, dob, email'); |
2893
|
|
|
|
|
|
|
|
2894
|
|
|
|
|
|
|
my $split = $string->split(', ', 2); |
2895
|
|
|
|
|
|
|
|
2896
|
|
|
|
|
|
|
# ["name", "age, dob, email"] |
2897
|
|
|
|
|
|
|
|
2898
|
|
|
|
|
|
|
=back |
2899
|
|
|
|
|
|
|
|
2900
|
|
|
|
|
|
|
=over 4 |
2901
|
|
|
|
|
|
|
|
2902
|
|
|
|
|
|
|
=item split example 3 |
2903
|
|
|
|
|
|
|
|
2904
|
|
|
|
|
|
|
package main; |
2905
|
|
|
|
|
|
|
|
2906
|
|
|
|
|
|
|
use Venus::String; |
2907
|
|
|
|
|
|
|
|
2908
|
|
|
|
|
|
|
my $string = Venus::String->new('name, age, dob, email'); |
2909
|
|
|
|
|
|
|
|
2910
|
|
|
|
|
|
|
my $split = $string->split(qr/\,\s*/); |
2911
|
|
|
|
|
|
|
|
2912
|
|
|
|
|
|
|
# ["name", "age", "dob", "email"] |
2913
|
|
|
|
|
|
|
|
2914
|
|
|
|
|
|
|
=back |
2915
|
|
|
|
|
|
|
|
2916
|
|
|
|
|
|
|
=cut |
2917
|
|
|
|
|
|
|
|
2918
|
|
|
|
|
|
|
=head2 stringified |
2919
|
|
|
|
|
|
|
|
2920
|
|
|
|
|
|
|
stringified() (Str) |
2921
|
|
|
|
|
|
|
|
2922
|
|
|
|
|
|
|
The stringified method returns the object, stringified (i.e. a dump of the |
2923
|
|
|
|
|
|
|
object's value). |
2924
|
|
|
|
|
|
|
|
2925
|
|
|
|
|
|
|
I> |
2926
|
|
|
|
|
|
|
|
2927
|
|
|
|
|
|
|
=over 4 |
2928
|
|
|
|
|
|
|
|
2929
|
|
|
|
|
|
|
=item stringified example 1 |
2930
|
|
|
|
|
|
|
|
2931
|
|
|
|
|
|
|
# given: synopsis; |
2932
|
|
|
|
|
|
|
|
2933
|
|
|
|
|
|
|
my $stringified = $string->stringified; |
2934
|
|
|
|
|
|
|
|
2935
|
|
|
|
|
|
|
# "hello world" |
2936
|
|
|
|
|
|
|
|
2937
|
|
|
|
|
|
|
=back |
2938
|
|
|
|
|
|
|
|
2939
|
|
|
|
|
|
|
=over 4 |
2940
|
|
|
|
|
|
|
|
2941
|
|
|
|
|
|
|
=item stringified example 2 |
2942
|
|
|
|
|
|
|
|
2943
|
|
|
|
|
|
|
package main; |
2944
|
|
|
|
|
|
|
|
2945
|
|
|
|
|
|
|
use Venus::String; |
2946
|
|
|
|
|
|
|
|
2947
|
|
|
|
|
|
|
my $string = Venus::String->new("hello\nworld"); |
2948
|
|
|
|
|
|
|
|
2949
|
|
|
|
|
|
|
my $stringified = $string->stringified; |
2950
|
|
|
|
|
|
|
|
2951
|
|
|
|
|
|
|
# "hello\\nworld" |
2952
|
|
|
|
|
|
|
|
2953
|
|
|
|
|
|
|
=back |
2954
|
|
|
|
|
|
|
|
2955
|
|
|
|
|
|
|
=cut |
2956
|
|
|
|
|
|
|
|
2957
|
|
|
|
|
|
|
=head2 strip |
2958
|
|
|
|
|
|
|
|
2959
|
|
|
|
|
|
|
strip() (Str) |
2960
|
|
|
|
|
|
|
|
2961
|
|
|
|
|
|
|
The strip method returns the string replacing occurences of 2 or more |
2962
|
|
|
|
|
|
|
whitespaces with a single whitespace. |
2963
|
|
|
|
|
|
|
|
2964
|
|
|
|
|
|
|
I> |
2965
|
|
|
|
|
|
|
|
2966
|
|
|
|
|
|
|
=over 4 |
2967
|
|
|
|
|
|
|
|
2968
|
|
|
|
|
|
|
=item strip example 1 |
2969
|
|
|
|
|
|
|
|
2970
|
|
|
|
|
|
|
package main; |
2971
|
|
|
|
|
|
|
|
2972
|
|
|
|
|
|
|
use Venus::String; |
2973
|
|
|
|
|
|
|
|
2974
|
|
|
|
|
|
|
my $string = Venus::String->new('one, two, three'); |
2975
|
|
|
|
|
|
|
|
2976
|
|
|
|
|
|
|
my $strip = $string->strip; |
2977
|
|
|
|
|
|
|
|
2978
|
|
|
|
|
|
|
# "one, two, three" |
2979
|
|
|
|
|
|
|
|
2980
|
|
|
|
|
|
|
=back |
2981
|
|
|
|
|
|
|
|
2982
|
|
|
|
|
|
|
=cut |
2983
|
|
|
|
|
|
|
|
2984
|
|
|
|
|
|
|
=head2 substr |
2985
|
|
|
|
|
|
|
|
2986
|
|
|
|
|
|
|
substr(Num $offset, Num $length, Str $replace) (Str) |
2987
|
|
|
|
|
|
|
|
2988
|
|
|
|
|
|
|
The substr method calls the core L function with the object's string |
2989
|
|
|
|
|
|
|
value. In list context returns the result and the subject. |
2990
|
|
|
|
|
|
|
|
2991
|
|
|
|
|
|
|
I> |
2992
|
|
|
|
|
|
|
|
2993
|
|
|
|
|
|
|
=over 4 |
2994
|
|
|
|
|
|
|
|
2995
|
|
|
|
|
|
|
=item substr example 1 |
2996
|
|
|
|
|
|
|
|
2997
|
|
|
|
|
|
|
package main; |
2998
|
|
|
|
|
|
|
|
2999
|
|
|
|
|
|
|
use Venus::String; |
3000
|
|
|
|
|
|
|
|
3001
|
|
|
|
|
|
|
my $string = Venus::String->new('hello world'); |
3002
|
|
|
|
|
|
|
|
3003
|
|
|
|
|
|
|
my $substr = $string->substr(0, 5); |
3004
|
|
|
|
|
|
|
|
3005
|
|
|
|
|
|
|
# "hello" |
3006
|
|
|
|
|
|
|
|
3007
|
|
|
|
|
|
|
=back |
3008
|
|
|
|
|
|
|
|
3009
|
|
|
|
|
|
|
=over 4 |
3010
|
|
|
|
|
|
|
|
3011
|
|
|
|
|
|
|
=item substr example 2 |
3012
|
|
|
|
|
|
|
|
3013
|
|
|
|
|
|
|
package main; |
3014
|
|
|
|
|
|
|
|
3015
|
|
|
|
|
|
|
use Venus::String; |
3016
|
|
|
|
|
|
|
|
3017
|
|
|
|
|
|
|
my $string = Venus::String->new('hello world'); |
3018
|
|
|
|
|
|
|
|
3019
|
|
|
|
|
|
|
my $substr = $string->substr(6, 5); |
3020
|
|
|
|
|
|
|
|
3021
|
|
|
|
|
|
|
# "world" |
3022
|
|
|
|
|
|
|
|
3023
|
|
|
|
|
|
|
=back |
3024
|
|
|
|
|
|
|
|
3025
|
|
|
|
|
|
|
=over 4 |
3026
|
|
|
|
|
|
|
|
3027
|
|
|
|
|
|
|
=item substr example 3 |
3028
|
|
|
|
|
|
|
|
3029
|
|
|
|
|
|
|
package main; |
3030
|
|
|
|
|
|
|
|
3031
|
|
|
|
|
|
|
use Venus::String; |
3032
|
|
|
|
|
|
|
|
3033
|
|
|
|
|
|
|
my $string = Venus::String->new('hello world'); |
3034
|
|
|
|
|
|
|
|
3035
|
|
|
|
|
|
|
my $substr = $string->substr(6, 5, 'universe'); |
3036
|
|
|
|
|
|
|
|
3037
|
|
|
|
|
|
|
# "hello universe" |
3038
|
|
|
|
|
|
|
|
3039
|
|
|
|
|
|
|
=back |
3040
|
|
|
|
|
|
|
|
3041
|
|
|
|
|
|
|
=over 4 |
3042
|
|
|
|
|
|
|
|
3043
|
|
|
|
|
|
|
=item substr example 4 |
3044
|
|
|
|
|
|
|
|
3045
|
|
|
|
|
|
|
package main; |
3046
|
|
|
|
|
|
|
|
3047
|
|
|
|
|
|
|
use Venus::String; |
3048
|
|
|
|
|
|
|
|
3049
|
|
|
|
|
|
|
my $string = Venus::String->new('hello world'); |
3050
|
|
|
|
|
|
|
|
3051
|
|
|
|
|
|
|
my ($result, $subject) = $string->substr(6, 5, 'universe'); |
3052
|
|
|
|
|
|
|
|
3053
|
|
|
|
|
|
|
# ("world", "hello universe") |
3054
|
|
|
|
|
|
|
|
3055
|
|
|
|
|
|
|
=back |
3056
|
|
|
|
|
|
|
|
3057
|
|
|
|
|
|
|
=cut |
3058
|
|
|
|
|
|
|
|
3059
|
|
|
|
|
|
|
=head2 template |
3060
|
|
|
|
|
|
|
|
3061
|
|
|
|
|
|
|
template(Str | CodeRef $code, Any @args) (Any) |
3062
|
|
|
|
|
|
|
|
3063
|
|
|
|
|
|
|
The template method uses the underlying string value to build and return a |
3064
|
|
|
|
|
|
|
L object, or dispatches to the coderef or method provided. |
3065
|
|
|
|
|
|
|
|
3066
|
|
|
|
|
|
|
I> |
3067
|
|
|
|
|
|
|
|
3068
|
|
|
|
|
|
|
=over 4 |
3069
|
|
|
|
|
|
|
|
3070
|
|
|
|
|
|
|
=item template example 1 |
3071
|
|
|
|
|
|
|
|
3072
|
|
|
|
|
|
|
package main; |
3073
|
|
|
|
|
|
|
|
3074
|
|
|
|
|
|
|
use Venus::String; |
3075
|
|
|
|
|
|
|
|
3076
|
|
|
|
|
|
|
my $string = Venus::String->new('hello {{name}}'); |
3077
|
|
|
|
|
|
|
|
3078
|
|
|
|
|
|
|
my $template = $string->template; |
3079
|
|
|
|
|
|
|
|
3080
|
|
|
|
|
|
|
# bless({...}, "Venus::Template") |
3081
|
|
|
|
|
|
|
|
3082
|
|
|
|
|
|
|
=back |
3083
|
|
|
|
|
|
|
|
3084
|
|
|
|
|
|
|
=over 4 |
3085
|
|
|
|
|
|
|
|
3086
|
|
|
|
|
|
|
=item template example 2 |
3087
|
|
|
|
|
|
|
|
3088
|
|
|
|
|
|
|
package main; |
3089
|
|
|
|
|
|
|
|
3090
|
|
|
|
|
|
|
use Venus::String; |
3091
|
|
|
|
|
|
|
|
3092
|
|
|
|
|
|
|
my $string = Venus::String->new('hello {{name}}'); |
3093
|
|
|
|
|
|
|
|
3094
|
|
|
|
|
|
|
my $template = $string->template('render', undef, { |
3095
|
|
|
|
|
|
|
name => 'user', |
3096
|
|
|
|
|
|
|
}); |
3097
|
|
|
|
|
|
|
|
3098
|
|
|
|
|
|
|
# "hello user" |
3099
|
|
|
|
|
|
|
|
3100
|
|
|
|
|
|
|
=back |
3101
|
|
|
|
|
|
|
|
3102
|
|
|
|
|
|
|
=cut |
3103
|
|
|
|
|
|
|
|
3104
|
|
|
|
|
|
|
=head2 titlecase |
3105
|
|
|
|
|
|
|
|
3106
|
|
|
|
|
|
|
titlecase() (Str) |
3107
|
|
|
|
|
|
|
|
3108
|
|
|
|
|
|
|
The titlecase method returns the string capitalizing the first character of |
3109
|
|
|
|
|
|
|
each word. |
3110
|
|
|
|
|
|
|
|
3111
|
|
|
|
|
|
|
I> |
3112
|
|
|
|
|
|
|
|
3113
|
|
|
|
|
|
|
=over 4 |
3114
|
|
|
|
|
|
|
|
3115
|
|
|
|
|
|
|
=item titlecase example 1 |
3116
|
|
|
|
|
|
|
|
3117
|
|
|
|
|
|
|
# given: synopsis; |
3118
|
|
|
|
|
|
|
|
3119
|
|
|
|
|
|
|
my $titlecase = $string->titlecase; |
3120
|
|
|
|
|
|
|
|
3121
|
|
|
|
|
|
|
# "Hello World" |
3122
|
|
|
|
|
|
|
|
3123
|
|
|
|
|
|
|
=back |
3124
|
|
|
|
|
|
|
|
3125
|
|
|
|
|
|
|
=cut |
3126
|
|
|
|
|
|
|
|
3127
|
|
|
|
|
|
|
=head2 trim |
3128
|
|
|
|
|
|
|
|
3129
|
|
|
|
|
|
|
trim() (Str) |
3130
|
|
|
|
|
|
|
|
3131
|
|
|
|
|
|
|
The trim method removes one or more consecutive leading and/or trailing spaces |
3132
|
|
|
|
|
|
|
from the string. |
3133
|
|
|
|
|
|
|
|
3134
|
|
|
|
|
|
|
I> |
3135
|
|
|
|
|
|
|
|
3136
|
|
|
|
|
|
|
=over 4 |
3137
|
|
|
|
|
|
|
|
3138
|
|
|
|
|
|
|
=item trim example 1 |
3139
|
|
|
|
|
|
|
|
3140
|
|
|
|
|
|
|
package main; |
3141
|
|
|
|
|
|
|
|
3142
|
|
|
|
|
|
|
use Venus::String; |
3143
|
|
|
|
|
|
|
|
3144
|
|
|
|
|
|
|
my $string = Venus::String->new(' system is ready '); |
3145
|
|
|
|
|
|
|
|
3146
|
|
|
|
|
|
|
my $trim = $string->trim; |
3147
|
|
|
|
|
|
|
|
3148
|
|
|
|
|
|
|
# "system is ready" |
3149
|
|
|
|
|
|
|
|
3150
|
|
|
|
|
|
|
=back |
3151
|
|
|
|
|
|
|
|
3152
|
|
|
|
|
|
|
=cut |
3153
|
|
|
|
|
|
|
|
3154
|
|
|
|
|
|
|
=head2 tv |
3155
|
|
|
|
|
|
|
|
3156
|
|
|
|
|
|
|
tv(Any $arg) (Bool) |
3157
|
|
|
|
|
|
|
|
3158
|
|
|
|
|
|
|
The tv method performs a I<"type-and-value-equal-to"> operation using argument |
3159
|
|
|
|
|
|
|
provided. |
3160
|
|
|
|
|
|
|
|
3161
|
|
|
|
|
|
|
I> |
3162
|
|
|
|
|
|
|
|
3163
|
|
|
|
|
|
|
=over 4 |
3164
|
|
|
|
|
|
|
|
3165
|
|
|
|
|
|
|
=item tv example 1 |
3166
|
|
|
|
|
|
|
|
3167
|
|
|
|
|
|
|
package main; |
3168
|
|
|
|
|
|
|
|
3169
|
|
|
|
|
|
|
use Venus::Array; |
3170
|
|
|
|
|
|
|
use Venus::String; |
3171
|
|
|
|
|
|
|
|
3172
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
3173
|
|
|
|
|
|
|
my $rvalue = Venus::Array->new; |
3174
|
|
|
|
|
|
|
|
3175
|
|
|
|
|
|
|
my $result = $lvalue->tv($rvalue); |
3176
|
|
|
|
|
|
|
|
3177
|
|
|
|
|
|
|
# 0 |
3178
|
|
|
|
|
|
|
|
3179
|
|
|
|
|
|
|
=back |
3180
|
|
|
|
|
|
|
|
3181
|
|
|
|
|
|
|
=over 4 |
3182
|
|
|
|
|
|
|
|
3183
|
|
|
|
|
|
|
=item tv example 2 |
3184
|
|
|
|
|
|
|
|
3185
|
|
|
|
|
|
|
package main; |
3186
|
|
|
|
|
|
|
|
3187
|
|
|
|
|
|
|
use Venus::Code; |
3188
|
|
|
|
|
|
|
use Venus::String; |
3189
|
|
|
|
|
|
|
|
3190
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
3191
|
|
|
|
|
|
|
my $rvalue = Venus::Code->new; |
3192
|
|
|
|
|
|
|
|
3193
|
|
|
|
|
|
|
my $result = $lvalue->tv($rvalue); |
3194
|
|
|
|
|
|
|
|
3195
|
|
|
|
|
|
|
# 0 |
3196
|
|
|
|
|
|
|
|
3197
|
|
|
|
|
|
|
=back |
3198
|
|
|
|
|
|
|
|
3199
|
|
|
|
|
|
|
=over 4 |
3200
|
|
|
|
|
|
|
|
3201
|
|
|
|
|
|
|
=item tv example 3 |
3202
|
|
|
|
|
|
|
|
3203
|
|
|
|
|
|
|
package main; |
3204
|
|
|
|
|
|
|
|
3205
|
|
|
|
|
|
|
use Venus::Float; |
3206
|
|
|
|
|
|
|
use Venus::String; |
3207
|
|
|
|
|
|
|
|
3208
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
3209
|
|
|
|
|
|
|
my $rvalue = Venus::Float->new; |
3210
|
|
|
|
|
|
|
|
3211
|
|
|
|
|
|
|
my $result = $lvalue->tv($rvalue); |
3212
|
|
|
|
|
|
|
|
3213
|
|
|
|
|
|
|
# 0 |
3214
|
|
|
|
|
|
|
|
3215
|
|
|
|
|
|
|
=back |
3216
|
|
|
|
|
|
|
|
3217
|
|
|
|
|
|
|
=over 4 |
3218
|
|
|
|
|
|
|
|
3219
|
|
|
|
|
|
|
=item tv example 4 |
3220
|
|
|
|
|
|
|
|
3221
|
|
|
|
|
|
|
package main; |
3222
|
|
|
|
|
|
|
|
3223
|
|
|
|
|
|
|
use Venus::Hash; |
3224
|
|
|
|
|
|
|
use Venus::String; |
3225
|
|
|
|
|
|
|
|
3226
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
3227
|
|
|
|
|
|
|
my $rvalue = Venus::Hash->new; |
3228
|
|
|
|
|
|
|
|
3229
|
|
|
|
|
|
|
my $result = $lvalue->tv($rvalue); |
3230
|
|
|
|
|
|
|
|
3231
|
|
|
|
|
|
|
# 0 |
3232
|
|
|
|
|
|
|
|
3233
|
|
|
|
|
|
|
=back |
3234
|
|
|
|
|
|
|
|
3235
|
|
|
|
|
|
|
=over 4 |
3236
|
|
|
|
|
|
|
|
3237
|
|
|
|
|
|
|
=item tv example 5 |
3238
|
|
|
|
|
|
|
|
3239
|
|
|
|
|
|
|
package main; |
3240
|
|
|
|
|
|
|
|
3241
|
|
|
|
|
|
|
use Venus::Number; |
3242
|
|
|
|
|
|
|
use Venus::String; |
3243
|
|
|
|
|
|
|
|
3244
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
3245
|
|
|
|
|
|
|
my $rvalue = Venus::Number->new; |
3246
|
|
|
|
|
|
|
|
3247
|
|
|
|
|
|
|
my $result = $lvalue->tv($rvalue); |
3248
|
|
|
|
|
|
|
|
3249
|
|
|
|
|
|
|
# 0 |
3250
|
|
|
|
|
|
|
|
3251
|
|
|
|
|
|
|
=back |
3252
|
|
|
|
|
|
|
|
3253
|
|
|
|
|
|
|
=over 4 |
3254
|
|
|
|
|
|
|
|
3255
|
|
|
|
|
|
|
=item tv example 6 |
3256
|
|
|
|
|
|
|
|
3257
|
|
|
|
|
|
|
package main; |
3258
|
|
|
|
|
|
|
|
3259
|
|
|
|
|
|
|
use Venus::Regexp; |
3260
|
|
|
|
|
|
|
use Venus::String; |
3261
|
|
|
|
|
|
|
|
3262
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
3263
|
|
|
|
|
|
|
my $rvalue = Venus::Regexp->new; |
3264
|
|
|
|
|
|
|
|
3265
|
|
|
|
|
|
|
my $result = $lvalue->tv($rvalue); |
3266
|
|
|
|
|
|
|
|
3267
|
|
|
|
|
|
|
# 0 |
3268
|
|
|
|
|
|
|
|
3269
|
|
|
|
|
|
|
=back |
3270
|
|
|
|
|
|
|
|
3271
|
|
|
|
|
|
|
=over 4 |
3272
|
|
|
|
|
|
|
|
3273
|
|
|
|
|
|
|
=item tv example 7 |
3274
|
|
|
|
|
|
|
|
3275
|
|
|
|
|
|
|
package main; |
3276
|
|
|
|
|
|
|
|
3277
|
|
|
|
|
|
|
use Venus::Scalar; |
3278
|
|
|
|
|
|
|
use Venus::String; |
3279
|
|
|
|
|
|
|
|
3280
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
3281
|
|
|
|
|
|
|
my $rvalue = Venus::Scalar->new; |
3282
|
|
|
|
|
|
|
|
3283
|
|
|
|
|
|
|
my $result = $lvalue->tv($rvalue); |
3284
|
|
|
|
|
|
|
|
3285
|
|
|
|
|
|
|
# 0 |
3286
|
|
|
|
|
|
|
|
3287
|
|
|
|
|
|
|
=back |
3288
|
|
|
|
|
|
|
|
3289
|
|
|
|
|
|
|
=over 4 |
3290
|
|
|
|
|
|
|
|
3291
|
|
|
|
|
|
|
=item tv example 8 |
3292
|
|
|
|
|
|
|
|
3293
|
|
|
|
|
|
|
package main; |
3294
|
|
|
|
|
|
|
|
3295
|
|
|
|
|
|
|
use Venus::String; |
3296
|
|
|
|
|
|
|
|
3297
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
3298
|
|
|
|
|
|
|
my $rvalue = Venus::String->new; |
3299
|
|
|
|
|
|
|
|
3300
|
|
|
|
|
|
|
my $result = $lvalue->tv($rvalue); |
3301
|
|
|
|
|
|
|
|
3302
|
|
|
|
|
|
|
# 1 |
3303
|
|
|
|
|
|
|
|
3304
|
|
|
|
|
|
|
=back |
3305
|
|
|
|
|
|
|
|
3306
|
|
|
|
|
|
|
=over 4 |
3307
|
|
|
|
|
|
|
|
3308
|
|
|
|
|
|
|
=item tv example 9 |
3309
|
|
|
|
|
|
|
|
3310
|
|
|
|
|
|
|
package main; |
3311
|
|
|
|
|
|
|
|
3312
|
|
|
|
|
|
|
use Venus::String; |
3313
|
|
|
|
|
|
|
use Venus::Undef; |
3314
|
|
|
|
|
|
|
|
3315
|
|
|
|
|
|
|
my $lvalue = Venus::String->new; |
3316
|
|
|
|
|
|
|
my $rvalue = Venus::Undef->new; |
3317
|
|
|
|
|
|
|
|
3318
|
|
|
|
|
|
|
my $result = $lvalue->tv($rvalue); |
3319
|
|
|
|
|
|
|
|
3320
|
|
|
|
|
|
|
# 0 |
3321
|
|
|
|
|
|
|
|
3322
|
|
|
|
|
|
|
=back |
3323
|
|
|
|
|
|
|
|
3324
|
|
|
|
|
|
|
=cut |
3325
|
|
|
|
|
|
|
|
3326
|
|
|
|
|
|
|
=head2 uc |
3327
|
|
|
|
|
|
|
|
3328
|
|
|
|
|
|
|
uc() (Str) |
3329
|
|
|
|
|
|
|
|
3330
|
|
|
|
|
|
|
The uc method returns an uppercased version of the string. |
3331
|
|
|
|
|
|
|
|
3332
|
|
|
|
|
|
|
I> |
3333
|
|
|
|
|
|
|
|
3334
|
|
|
|
|
|
|
=over 4 |
3335
|
|
|
|
|
|
|
|
3336
|
|
|
|
|
|
|
=item uc example 1 |
3337
|
|
|
|
|
|
|
|
3338
|
|
|
|
|
|
|
# given: synopsis; |
3339
|
|
|
|
|
|
|
|
3340
|
|
|
|
|
|
|
my $uc = $string->uc; |
3341
|
|
|
|
|
|
|
|
3342
|
|
|
|
|
|
|
# "HELLO WORLD" |
3343
|
|
|
|
|
|
|
|
3344
|
|
|
|
|
|
|
=back |
3345
|
|
|
|
|
|
|
|
3346
|
|
|
|
|
|
|
=cut |
3347
|
|
|
|
|
|
|
|
3348
|
|
|
|
|
|
|
=head2 ucfirst |
3349
|
|
|
|
|
|
|
|
3350
|
|
|
|
|
|
|
ucfirst() (Str) |
3351
|
|
|
|
|
|
|
|
3352
|
|
|
|
|
|
|
The ucfirst method returns a the string with the first character uppercased. |
3353
|
|
|
|
|
|
|
|
3354
|
|
|
|
|
|
|
I> |
3355
|
|
|
|
|
|
|
|
3356
|
|
|
|
|
|
|
=over 4 |
3357
|
|
|
|
|
|
|
|
3358
|
|
|
|
|
|
|
=item ucfirst example 1 |
3359
|
|
|
|
|
|
|
|
3360
|
|
|
|
|
|
|
# given: synopsis; |
3361
|
|
|
|
|
|
|
|
3362
|
|
|
|
|
|
|
my $ucfirst = $string->ucfirst; |
3363
|
|
|
|
|
|
|
|
3364
|
|
|
|
|
|
|
# "Hello world" |
3365
|
|
|
|
|
|
|
|
3366
|
|
|
|
|
|
|
=back |
3367
|
|
|
|
|
|
|
|
3368
|
|
|
|
|
|
|
=cut |
3369
|
|
|
|
|
|
|
|
3370
|
|
|
|
|
|
|
=head2 uppercase |
3371
|
|
|
|
|
|
|
|
3372
|
|
|
|
|
|
|
uppercase() (Str) |
3373
|
|
|
|
|
|
|
|
3374
|
|
|
|
|
|
|
The uppercase method is an alias to the uc method. |
3375
|
|
|
|
|
|
|
|
3376
|
|
|
|
|
|
|
I> |
3377
|
|
|
|
|
|
|
|
3378
|
|
|
|
|
|
|
=over 4 |
3379
|
|
|
|
|
|
|
|
3380
|
|
|
|
|
|
|
=item uppercase example 1 |
3381
|
|
|
|
|
|
|
|
3382
|
|
|
|
|
|
|
# given: synopsis; |
3383
|
|
|
|
|
|
|
|
3384
|
|
|
|
|
|
|
my $uppercase = $string->uppercase; |
3385
|
|
|
|
|
|
|
|
3386
|
|
|
|
|
|
|
# "HELLO WORLD" |
3387
|
|
|
|
|
|
|
|
3388
|
|
|
|
|
|
|
=back |
3389
|
|
|
|
|
|
|
|
3390
|
|
|
|
|
|
|
=cut |
3391
|
|
|
|
|
|
|
|
3392
|
|
|
|
|
|
|
=head2 words |
3393
|
|
|
|
|
|
|
|
3394
|
|
|
|
|
|
|
words() (ArrayRef[Str]) |
3395
|
|
|
|
|
|
|
|
3396
|
|
|
|
|
|
|
The words method returns an arrayref by splitting on 1 or more consecutive |
3397
|
|
|
|
|
|
|
spaces. |
3398
|
|
|
|
|
|
|
|
3399
|
|
|
|
|
|
|
I> |
3400
|
|
|
|
|
|
|
|
3401
|
|
|
|
|
|
|
=over 4 |
3402
|
|
|
|
|
|
|
|
3403
|
|
|
|
|
|
|
=item words example 1 |
3404
|
|
|
|
|
|
|
|
3405
|
|
|
|
|
|
|
package main; |
3406
|
|
|
|
|
|
|
|
3407
|
|
|
|
|
|
|
use Venus::String; |
3408
|
|
|
|
|
|
|
|
3409
|
|
|
|
|
|
|
my $string = Venus::String->new( |
3410
|
|
|
|
|
|
|
'is this a bug we\'re experiencing' |
3411
|
|
|
|
|
|
|
); |
3412
|
|
|
|
|
|
|
|
3413
|
|
|
|
|
|
|
my $words = $string->words; |
3414
|
|
|
|
|
|
|
|
3415
|
|
|
|
|
|
|
# ["is", "this", "a", "bug", "we're", "experiencing"] |
3416
|
|
|
|
|
|
|
|
3417
|
|
|
|
|
|
|
=back |
3418
|
|
|
|
|
|
|
|
3419
|
|
|
|
|
|
|
=cut |
3420
|
|
|
|
|
|
|
|
3421
|
|
|
|
|
|
|
=head1 OPERATORS |
3422
|
|
|
|
|
|
|
|
3423
|
|
|
|
|
|
|
This package overloads the following operators: |
3424
|
|
|
|
|
|
|
|
3425
|
|
|
|
|
|
|
=cut |
3426
|
|
|
|
|
|
|
|
3427
|
|
|
|
|
|
|
=over 4 |
3428
|
|
|
|
|
|
|
|
3429
|
|
|
|
|
|
|
=item operation: C<("")> |
3430
|
|
|
|
|
|
|
|
3431
|
|
|
|
|
|
|
This package overloads the C<""> operator. |
3432
|
|
|
|
|
|
|
|
3433
|
|
|
|
|
|
|
B |
3434
|
|
|
|
|
|
|
|
3435
|
|
|
|
|
|
|
# given: synopsis; |
3436
|
|
|
|
|
|
|
|
3437
|
|
|
|
|
|
|
my $result = "$string"; |
3438
|
|
|
|
|
|
|
|
3439
|
|
|
|
|
|
|
# "hello world" |
3440
|
|
|
|
|
|
|
|
3441
|
|
|
|
|
|
|
B |
3442
|
|
|
|
|
|
|
|
3443
|
|
|
|
|
|
|
# given: synopsis; |
3444
|
|
|
|
|
|
|
|
3445
|
|
|
|
|
|
|
my $result = "$string, $string"; |
3446
|
|
|
|
|
|
|
|
3447
|
|
|
|
|
|
|
# "hello world, hello world" |
3448
|
|
|
|
|
|
|
|
3449
|
|
|
|
|
|
|
=back |
3450
|
|
|
|
|
|
|
|
3451
|
|
|
|
|
|
|
=over 4 |
3452
|
|
|
|
|
|
|
|
3453
|
|
|
|
|
|
|
=item operation: C<(eq)> |
3454
|
|
|
|
|
|
|
|
3455
|
|
|
|
|
|
|
This package overloads the C operator. |
3456
|
|
|
|
|
|
|
|
3457
|
|
|
|
|
|
|
B |
3458
|
|
|
|
|
|
|
|
3459
|
|
|
|
|
|
|
# given: synopsis; |
3460
|
|
|
|
|
|
|
|
3461
|
|
|
|
|
|
|
my $result = $string eq 'hello world'; |
3462
|
|
|
|
|
|
|
|
3463
|
|
|
|
|
|
|
# 1 |
3464
|
|
|
|
|
|
|
|
3465
|
|
|
|
|
|
|
B |
3466
|
|
|
|
|
|
|
|
3467
|
|
|
|
|
|
|
package main; |
3468
|
|
|
|
|
|
|
|
3469
|
|
|
|
|
|
|
use Venus::String; |
3470
|
|
|
|
|
|
|
|
3471
|
|
|
|
|
|
|
my $string1 = Venus::String->new('hello world'); |
3472
|
|
|
|
|
|
|
my $string2 = Venus::String->new('hello world'); |
3473
|
|
|
|
|
|
|
|
3474
|
|
|
|
|
|
|
my $result = $string1 eq $string2; |
3475
|
|
|
|
|
|
|
|
3476
|
|
|
|
|
|
|
# 1 |
3477
|
|
|
|
|
|
|
|
3478
|
|
|
|
|
|
|
=back |
3479
|
|
|
|
|
|
|
|
3480
|
|
|
|
|
|
|
=over 4 |
3481
|
|
|
|
|
|
|
|
3482
|
|
|
|
|
|
|
=item operation: C<(ne)> |
3483
|
|
|
|
|
|
|
|
3484
|
|
|
|
|
|
|
This package overloads the C operator. |
3485
|
|
|
|
|
|
|
|
3486
|
|
|
|
|
|
|
B |
3487
|
|
|
|
|
|
|
|
3488
|
|
|
|
|
|
|
# given: synopsis; |
3489
|
|
|
|
|
|
|
|
3490
|
|
|
|
|
|
|
my $result = $string ne 'Hello world'; |
3491
|
|
|
|
|
|
|
|
3492
|
|
|
|
|
|
|
1; |
3493
|
|
|
|
|
|
|
|
3494
|
|
|
|
|
|
|
B |
3495
|
|
|
|
|
|
|
|
3496
|
|
|
|
|
|
|
package main; |
3497
|
|
|
|
|
|
|
|
3498
|
|
|
|
|
|
|
use Venus::String; |
3499
|
|
|
|
|
|
|
|
3500
|
|
|
|
|
|
|
my $string1 = Venus::String->new('hello world'); |
3501
|
|
|
|
|
|
|
my $string2 = Venus::String->new('Hello world'); |
3502
|
|
|
|
|
|
|
|
3503
|
|
|
|
|
|
|
my $result = $string1 ne $string2; |
3504
|
|
|
|
|
|
|
|
3505
|
|
|
|
|
|
|
# 1 |
3506
|
|
|
|
|
|
|
|
3507
|
|
|
|
|
|
|
=back |
3508
|
|
|
|
|
|
|
|
3509
|
|
|
|
|
|
|
=over 4 |
3510
|
|
|
|
|
|
|
|
3511
|
|
|
|
|
|
|
=item operation: C<(qr)> |
3512
|
|
|
|
|
|
|
|
3513
|
|
|
|
|
|
|
This package overloads the C operator. |
3514
|
|
|
|
|
|
|
|
3515
|
|
|
|
|
|
|
B |
3516
|
|
|
|
|
|
|
|
3517
|
|
|
|
|
|
|
# given: synopsis; |
3518
|
|
|
|
|
|
|
|
3519
|
|
|
|
|
|
|
my $test = 'hello world' =~ qr/$string/; |
3520
|
|
|
|
|
|
|
|
3521
|
|
|
|
|
|
|
# 1 |
3522
|
|
|
|
|
|
|
|
3523
|
|
|
|
|
|
|
=back |
3524
|
|
|
|
|
|
|
|
3525
|
|
|
|
|
|
|
=head1 AUTHORS |
3526
|
|
|
|
|
|
|
|
3527
|
|
|
|
|
|
|
Awncorp, C |
3528
|
|
|
|
|
|
|
|
3529
|
|
|
|
|
|
|
=cut |
3530
|
|
|
|
|
|
|
|
3531
|
|
|
|
|
|
|
=head1 LICENSE |
3532
|
|
|
|
|
|
|
|
3533
|
|
|
|
|
|
|
Copyright (C) 2000, Al Newkirk. |
3534
|
|
|
|
|
|
|
|
3535
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify it under |
3536
|
|
|
|
|
|
|
the terms of the Apache license version 2.0. |
3537
|
|
|
|
|
|
|
|
3538
|
|
|
|
|
|
|
=cut |