| 1 | package Venus::String; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 26 | ▶ | use 5.018; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 26 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 26 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | # IMPORTS | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 26 | ▶ | use Venus::Class 'base'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | # INHERITS | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 26 | base 'Venus::Kind::Value'; | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | # OVERLOADS | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 26 | ▶ | use overload ( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 26 | ▶ | 'eq' => sub{$_[0]->value eq "$_[1]"}, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 2 | ▶ | 'ne' => sub{$_[0]->value ne "$_[1]"}, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 1 | ▶ | 'qr' => sub{qr/@{[quotemeta($_[0]->value)]}/}, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 26 | fallback => 1, | |||||||||||||||||||||||||||
| 23 | 26 | ); | |||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | # METHODS | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 1 | ▶ | sub append { | ||||||||||||||||||||||||||
|
Subroutine
append: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 28 | 1 | my ($self, @args) = @_; | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 1 | return $self->append_with(' ', @args); | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 2 | ▶ | sub append_with { | ||||||||||||||||||||||||||
|
Subroutine
append_with: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 34 | 2 | my ($self, $delimiter, @args) = @_; | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 2 | my $data = $self->get; | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 2 | ▶ | return CORE::join($delimiter // '', $data, @args); | ||||||||||||||||||||||||||
|
Condition50%1/2
$delimiter // ""
MC/DC0%0/1
$delimiter // ""
$delimiter
Truth table50%1/2
A
A= $delimiter
| |||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 2 | ▶ | sub camelcase { | ||||||||||||||||||||||||||
|
Subroutine
camelcase: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 42 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 2 | my $data = $self->get; | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 2 | my $result = CORE::ucfirst(CORE::lc($data)); | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 2 | $result =~ s/[^a-zA-Z0-9]+([a-z])/\U$1/g; | |||||||||||||||||||||||||||
| 49 | 2 | $result =~ s/[^a-zA-Z0-9]+//g; | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 2 | return CORE::lcfirst($result); | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 2 | ▶ | sub chomp { | ||||||||||||||||||||||||||
|
Subroutine
chomp: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 55 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 2 | my $data = $self->get; | |||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 2 | CORE::chomp($data); | |||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 2 | return $data; | |||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 1 | ▶ | sub chop { | ||||||||||||||||||||||||||
|
Subroutine
chop: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 65 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 1 | CORE::chop($data); | |||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 1 | return $data; | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 270 | ▶ | sub comparer { | ||||||||||||||||||||||||||
|
Subroutine
comparer: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 75 | 270 | my ($self) = @_; | |||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 270 | my $data = $self->get; | |||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 270 | require Scalar::Util; | |||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 270 | ▶ | return Scalar::Util::looks_like_number($data) ? 'numified' : 'stringified'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 1 | ▶ | sub concat { | ||||||||||||||||||||||||||
|
Subroutine
concat: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 85 | 1 | my ($self, @args) = @_; | |||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 1 | return CORE::join('', $data, @args); | |||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 3 | ▶ | sub contains { | ||||||||||||||||||||||||||
|
Subroutine
contains: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||||||||||
| 93 | 3 | my ($self, $pattern) = @_; | |||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 3 | my $data = $self->get; | |||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 3 | ▶ | return 0 unless CORE::defined($pattern); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 3 | my $regexp = UNIVERSAL::isa($pattern, 'Regexp'); | |||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 3 | ▶ | return CORE::index($data, $pattern) < 0 ? 0 : 1 if !$regexp; | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 1 | ▶ | return ($data =~ $pattern) ? true : false; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | 183 | ▶ | sub default { | ||||||||||||||||||||||||||
|
Subroutine
default: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 107 | 183 | return ''; | |||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | 2 | ▶ | sub format { | ||||||||||||||||||||||||||
|
Subroutine
format: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 111 | 2 | my ($self, @args) = @_; | |||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 2 | my $data = $self->get; | |||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | 2 | return CORE::sprintf($data, @args); | |||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | 1 | ▶ | sub hex { | ||||||||||||||||||||||||||
|
Subroutine
hex: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 119 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | 1 | return CORE::hex($data); | |||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 3 | ▶ | sub index { | ||||||||||||||||||||||||||
|
Subroutine
index: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 127 | 3 | my ($self, $substr, $start) = @_; | |||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | 3 | my $data = $self->get; | |||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 3 | ▶ | return CORE::index($data, $substr) if not(CORE::defined($start)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 132 | 1 | return CORE::index($data, $substr, $start); | |||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | 1 | ▶ | sub kebabcase { | ||||||||||||||||||||||||||
|
Subroutine
kebabcase: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 136 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 139 | 1 | my $re = qr/[\W_]+/; | |||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | 1 | $data =~ s/$re/-/g; | |||||||||||||||||||||||||||
| 142 | 1 | $data =~ s/^$re|$re$//g; | |||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | 1 | return $data; | |||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | 1 | ▶ | sub lc { | ||||||||||||||||||||||||||
|
Subroutine
lc: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 148 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | 1 | return CORE::lc($data); | |||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | 1 | ▶ | sub lcfirst { | ||||||||||||||||||||||||||
|
Subroutine
lcfirst: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 156 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | 1 | return CORE::lcfirst($data); | |||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | 1 | ▶ | sub length { | ||||||||||||||||||||||||||
|
Subroutine
length: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 164 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | 1 | return CORE::length($data); | |||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | 2 | ▶ | sub lines { | ||||||||||||||||||||||||||
|
Subroutine
lines: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 172 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | 2 | my $data = $self->get; | |||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | 2 | return [CORE::split(/[\n\r]+/, $data)]; | |||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | 1 | ▶ | sub lowercase { | ||||||||||||||||||||||||||
|
Subroutine
lowercase: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 180 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 1 | return CORE::lc($data); | |||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | 76 | ▶ | sub numified { | ||||||||||||||||||||||||||
|
Subroutine
numified: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 188 | 76 | my ($self) = @_; | |||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | 76 | my $data = $self->get; | |||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | 76 | ▶ | return $self->comparer eq 'numified' ? (0 + $data) : $self->SUPER::numified(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | 1 | ▶ | sub pascalcase { | ||||||||||||||||||||||||||
|
Subroutine
pascalcase: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 196 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | 1 | my $result = CORE::ucfirst(CORE::lc($data)); | |||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | 1 | $result =~ s/[^a-zA-Z0-9]+([a-z])/\U$1/g; | |||||||||||||||||||||||||||
| 203 | 1 | $result =~ s/[^a-zA-Z0-9]+//g; | |||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | 1 | return $result; | |||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | 1 | ▶ | sub prepend { | ||||||||||||||||||||||||||
|
Subroutine
prepend: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 209 | 1 | my ($self, @args) = @_; | |||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | 1 | return $self->prepend_with(' ', @args); | |||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | 2 | ▶ | sub prepend_with { | ||||||||||||||||||||||||||
|
Subroutine
prepend_with: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 215 | 2 | my ($self, $delimiter, @args) = @_; | |||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | 2 | my $data = $self->get; | |||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | 2 | ▶ | return CORE::join($delimiter // '', @args, $data); | ||||||||||||||||||||||||||
|
Condition50%1/2
$delimiter // ""
MC/DC0%0/1
$delimiter // ""
$delimiter
Truth table50%1/2
A
A= $delimiter
| |||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | 2 | ▶ | sub repeat { | ||||||||||||||||||||||||||
|
Subroutine
repeat: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||
| 223 | 2 | my ($self, $count, $delimiter) = @_; | |||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||
| 225 | 2 | my $data = $self->get; | |||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | 2 | ▶ | return CORE::join($delimiter // '', CORE::map $data, 1..($count || 1)); | ||||||||||||||||||||||||||
|
Condition75%3/4
$delimiter // ""
$count || 1
MC/DC100%1/1
$delimiter // ""
$delimiter
MC/DC0%0/1
$count || 1
$count
Truth table100%2/2
A
A= $delimiter
Truth table50%1/2
A
A= $count
| |||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | 1 | ▶ | sub render { | ||||||||||||||||||||||||||
|
Subroutine
render: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 231 | 1 | my ($self, $tokens) = @_; | |||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | 1 | ▶ | $tokens ||= {}; | ||||||||||||||||||||||||||
|
Condition50%1/2
$tokens ||= {}
MC/DC0%0/1
$tokens ||= {}
$tokens
Truth table50%1/2
A
A= $tokens
| |||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | 1 | ▶ | while (my($key, $value) = each(%$tokens)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 238 | 1 | my $token = quotemeta $key; | |||||||||||||||||||||||||||
| 239 | 1 | $data =~ s/\{\{\s*$token\s*\}\}/$value/g; | |||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | 1 | return $data; | |||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | 1 | ▶ | sub replace { | ||||||||||||||||||||||||||
|
Subroutine
replace: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 246 | 1 | my ($self, $regexp, $replace, $flags) = @_; | |||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | 1 | require Venus::Regexp; | |||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | 1 | return Venus::Regexp->new($regexp)->replace($self->get, $replace, $flags); | |||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | 1 | ▶ | sub reverse { | ||||||||||||||||||||||||||
|
Subroutine
reverse: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 254 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | 1 | return scalar(CORE::reverse($data)); | |||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | 3 | ▶ | sub rindex { | ||||||||||||||||||||||||||
|
Subroutine
rindex: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 262 | 3 | my ($self, $substr, $start) = @_; | |||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | 3 | my $data = $self->get; | |||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | 3 | ▶ | return CORE::rindex($data, $substr) if not(CORE::defined($start)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 267 | 1 | return CORE::rindex($data, $substr, $start); | |||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | 1 | ▶ | sub search { | ||||||||||||||||||||||||||
|
Subroutine
search: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 271 | 1 | my ($self, $regexp) = @_; | |||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | 1 | require Venus::Regexp; | |||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | 1 | return Venus::Regexp->new($regexp)->search($self->get); | |||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | 1 | ▶ | sub snakecase { | ||||||||||||||||||||||||||
|
Subroutine
snakecase: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 279 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 282 | 1 | my $re = qr/[\W_]+/; | |||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | 1 | $data =~ s/$re/_/g; | |||||||||||||||||||||||||||
| 285 | 1 | $data =~ s/^$re|$re$//g; | |||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | 1 | return $data; | |||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | 3 | ▶ | sub split { | ||||||||||||||||||||||||||
|
Subroutine
split: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||||||||||
| 291 | 3 | my ($self, $pattern, $limit) = @_; | |||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | 3 | my $data = $self->get; | |||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||
| 295 | 3 | ▶ | $pattern //= ''; | ||||||||||||||||||||||||||
|
Condition50%1/2
$pattern //= ""
MC/DC0%0/1
$pattern //= ""
$pattern
Truth table50%1/2
A
A= $pattern
| |||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||
| 297 | 3 | my $regexp = UNIVERSAL::isa($pattern, 'Regexp'); | |||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | 3 | ▶ | $pattern = quotemeta($pattern) if $pattern and !$regexp; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$pattern and not $regexp
MC/DC50%1/2
$pattern and not $regexp
$pattern
not $regexp
Truth table66%2/3
A and not(B)
A= $patternB= not $regexp
| |||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | 3 | ▶ | return [CORE::split(/$pattern/, $data)] if !CORE::defined($limit); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 302 | 1 | return [CORE::split(/$pattern/, $data, $limit)]; | |||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | 1 | ▶ | sub strip { | ||||||||||||||||||||||||||
|
Subroutine
strip: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 306 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||
| 310 | 1 | $data =~ s/\s{2,}/ /g; | |||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||
| 312 | 1 | return $data; | |||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | 4 | ▶ | sub substr { | ||||||||||||||||||||||||||
|
Subroutine
substr: called CC=8 SCAR=21.8
Pod
documented
| |||||||||||||||||||||||||||||
| 316 | 4 | my ($self, $offset, $length, $replace) = @_; | |||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||
| 318 | 4 | my $data = $self->get; | |||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | 4 | ▶ | if (CORE::defined($replace)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 321 | 2 | ▶ | my $result = CORE::substr($data, $offset // 0, $length // 0, $replace); | ||||||||||||||||||||||||||
|
Condition50%2/4
$offset // 0
$length // 0
MC/DC0%0/1
$offset // 0
$offset
MC/DC0%0/1
$length // 0
$length
Truth table50%1/2
A
A= $offset
Truth table50%1/2
A
A= $length
| |||||||||||||||||||||||||||||
| 322 | 2 | ▶ | return wantarray ? ($result, $data) : $data; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||
| 324 | else { | ||||||||||||||||||||||||||||
| 325 | 2 | ▶ | my $result = CORE::substr($data, $offset // 0, $length // 0); | ||||||||||||||||||||||||||
|
Condition50%2/4
$offset // 0
$length // 0
MC/DC0%0/1
$offset // 0
$offset
MC/DC0%0/1
$length // 0
$length
Truth table50%1/2
A
A= $offset
Truth table50%1/2
A
A= $length
| |||||||||||||||||||||||||||||
| 326 | 2 | ▶ | return wantarray ? ($result, $data) : $result; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | 2 | ▶ | sub template { | ||||||||||||||||||||||||||
|
Subroutine
template: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 331 | 2 | my ($self, $code, @args) = @_; | |||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||
| 333 | 2 | require Venus::Template; | |||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||
| 335 | 2 | my $template = Venus::Template->new($self->get); | |||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | 2 | ▶ | return $code ? $template->$code(@args) : $template; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||
| 340 | 3 | ▶ | sub titlecase { | ||||||||||||||||||||||||||
|
Subroutine
titlecase: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 341 | 3 | my ($self) = @_; | |||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||
| 343 | 3 | my $data = $self->get; | |||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||
| 345 | 3 | $data =~ s/\b(\w)/\U$1/g; | |||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||
| 347 | 3 | return $data; | |||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | 1 | ▶ | sub trim { | ||||||||||||||||||||||||||
|
Subroutine
trim: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 351 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||
| 353 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||
| 355 | 1 | $data =~ s/^\s+|\s+$//g; | |||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||
| 357 | 1 | return $data; | |||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | 1 | ▶ | sub uc { | ||||||||||||||||||||||||||
|
Subroutine
uc: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 361 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||
| 363 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | 1 | return CORE::uc($data); | |||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | 1 | ▶ | sub ucfirst { | ||||||||||||||||||||||||||
|
Subroutine
ucfirst: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 369 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||
| 371 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||
| 373 | 1 | return CORE::ucfirst($data); | |||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||
| 376 | 1 | ▶ | sub uppercase { | ||||||||||||||||||||||||||
|
Subroutine
uppercase: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 377 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||
| 379 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||
| 381 | 1 | return CORE::uc($data); | |||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||
| 384 | 302 | ▶ | sub wrap { | ||||||||||||||||||||||||||
|
Subroutine
wrap: called CC=11 SCAR=24.0
Pod
documented
| |||||||||||||||||||||||||||||
| 385 | 302 | my ($self, $length, $indent) = @_; | |||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | 302 | ▶ | $length ||= 80; | ||||||||||||||||||||||||||
|
Condition100%2/2
$length ||= 80
MC/DC100%1/1
$length ||= 80
$length
Truth table100%2/2
A
A= $length
| |||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||
| 389 | 302 | ▶ | $indent ||= 0; | ||||||||||||||||||||||||||
|
Condition100%2/2
$indent ||= 0
MC/DC100%1/1
$indent ||= 0
$indent
Truth table100%2/2
A
A= $indent
| |||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | 302 | my $space = ' ' x $indent; | |||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||
| 393 | 302 | my $total_length = $length - CORE::length($space); | |||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||
| 395 | 302 | my @lines; | |||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||
| 397 | 302 | my @input_lines = split /\n/, $self->get; | |||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||
| 399 | 302 | for my $input_line (@input_lines) { | |||||||||||||||||||||||||||
| 400 | 305 | ▶ | if ($input_line eq '') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 401 | 13 | push @lines, $input_line; | |||||||||||||||||||||||||||
| 402 | 13 | next; | |||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||
| 405 | 292 | my ($saved_space) = ($input_line =~ /^(\s*)/); | |||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||
| 407 | 292 | ▶ | $saved_space ||= ''; | ||||||||||||||||||||||||||
|
Condition100%2/2
$saved_space ||= ""
MC/DC100%1/1
$saved_space ||= ""
$saved_space
Truth table100%2/2
A
A= $saved_space
| |||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||
| 409 | 292 | my @parts = split /\s+/, $input_line; | |||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||
| 411 | 292 | my $line = ''; | |||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||
| 413 | 292 | for my $part (@parts) { | |||||||||||||||||||||||||||
| 414 | 760 | ▶ | if (CORE::length($line) + CORE::length($part) + 1 > $total_length) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 415 | 4 | push @lines, $space . $saved_space . $line; | |||||||||||||||||||||||||||
| 416 | 4 | $line = $part; | |||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||
| 418 | else { | ||||||||||||||||||||||||||||
| 419 | 756 | ▶ | $line .= $line ? " $part" : $part; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||
| 423 | 292 | ▶ | push @lines, $space . $saved_space . $line if $line; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||
| 426 | 302 | ▶ | return wantarray ? (@lines) : join "\n", @lines; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||
| 429 | 1 | ▶ | sub words { | ||||||||||||||||||||||||||
|
Subroutine
words: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 430 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||
| 432 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||
| 434 | 1 | return [CORE::split(/\s+/, $data)]; | |||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||
| 437 | 26 | 1; | |||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||
| 441 | =head1 NAME | ||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||
| 443 | Venus::String - String Class | ||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||
| 445 | =cut | ||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||
| 447 | =head1 ABSTRACT | ||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||
| 449 | String Class for Perl 5 | ||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||
| 451 | =cut | ||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||
| 453 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||
| 455 | package main; | ||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||
| 457 | use Venus::String; | ||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||
| 459 | my $string = Venus::String->new('hello world'); | ||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||
| 461 | # $string->camelcase; | ||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||
| 463 | =cut | ||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||
| 465 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||
| 467 | This package provides methods for manipulating string data. | ||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||
| 469 | =cut | ||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||
| 471 | =head1 INHERITS | ||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||
| 473 | This package inherits behaviors from: | ||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||
| 475 | L<Venus::Kind::Value> | ||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||
| 477 | =cut | ||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||
| 479 | =head1 METHODS | ||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||
| 481 | This package provides the following methods: | ||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||
| 483 | =cut | ||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||
| 485 | =head2 append | ||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||
| 487 | append(string @parts) (string) | ||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||
| 489 | The append method appends arugments to the string using spaces. | ||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||
| 491 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||
| 493 | =over 4 | ||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||
| 495 | =item append example 1 | ||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||
| 497 | # given: synopsis; | ||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||
| 499 | my $append = $string->append('welcome'); | ||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||
| 501 | # "hello world welcome" | ||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||
| 503 | =back | ||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||
| 505 | =cut | ||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||
| 507 | =head2 append_with | ||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||
| 509 | append_with(string $delimiter, string @parts) (string) | ||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||
| 511 | The append_with method appends arugments to the string using the delimiter | ||||||||||||||||||||||||||||
| 512 | provided. | ||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||
| 514 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||
| 516 | =over 4 | ||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||
| 518 | =item append_with example 1 | ||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||
| 520 | # given: synopsis; | ||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||
| 522 | my $append = $string->append_with(', ', 'welcome'); | ||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||
| 524 | # "hello world, welcome" | ||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||
| 526 | =back | ||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||
| 528 | =cut | ||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||
| 530 | =head2 camelcase | ||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||
| 532 | camelcase() (string) | ||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||
| 534 | The camelcase method converts the string to camelcase. | ||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||
| 536 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||
| 538 | =over 4 | ||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||
| 540 | =item camelcase example 1 | ||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||
| 542 | # given: synopsis; | ||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||
| 544 | my $camelcase = $string->camelcase; | ||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||
| 546 | # "helloWorld" | ||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||
| 548 | =back | ||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||
| 550 | =cut | ||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||
| 552 | =head2 cast | ||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||
| 554 | cast(string $kind) (object | undef) | ||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||
| 556 | The cast method converts L<"value"|Venus::Kind::Value> objects between | ||||||||||||||||||||||||||||
| 557 | different I<"value"> object types, based on the name of the type provided. This | ||||||||||||||||||||||||||||
| 558 | method will return C<undef> if the invocant is not a L<Venus::Kind::Value>. | ||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||
| 560 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||
| 562 | =over 4 | ||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||
| 564 | =item cast example 1 | ||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||
| 566 | package main; | ||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||
| 568 | use Venus::String; | ||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||
| 570 | my $string = Venus::String->new; | ||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||
| 572 | my $cast = $string->cast('array'); | ||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||
| 574 | # bless({ value => [""] }, "Venus::Array") | ||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||
| 576 | =back | ||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||
| 578 | =over 4 | ||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||
| 580 | =item cast example 2 | ||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||
| 582 | package main; | ||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||
| 584 | use Venus::String; | ||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||
| 586 | my $string = Venus::String->new; | ||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||
| 588 | my $cast = $string->cast('boolean'); | ||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||
| 590 | # bless({ value => 0 }, "Venus::Boolean") | ||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||
| 592 | =back | ||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||
| 594 | =over 4 | ||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||
| 596 | =item cast example 3 | ||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||
| 598 | package main; | ||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||
| 600 | use Venus::String; | ||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||
| 602 | my $string = Venus::String->new; | ||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||
| 604 | my $cast = $string->cast('code'); | ||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||
| 606 | # bless({ value => sub { ... } }, "Venus::Code") | ||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||
| 608 | =back | ||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||
| 610 | =over 4 | ||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||
| 612 | =item cast example 4 | ||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||
| 614 | package main; | ||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||
| 616 | use Venus::String; | ||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||
| 618 | my $string = Venus::String->new; | ||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||
| 620 | my $cast = $string->cast('float'); | ||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||
| 622 | # bless({ value => "0.0" }, "Venus::Float") | ||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||
| 624 | =back | ||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||
| 626 | =over 4 | ||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||
| 628 | =item cast example 5 | ||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||
| 630 | package main; | ||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||
| 632 | use Venus::String; | ||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||
| 634 | my $string = Venus::String->new; | ||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||
| 636 | my $cast = $string->cast('hash'); | ||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||
| 638 | # bless({ value => { "" => "" } }, "Venus::Hash") | ||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||
| 640 | =back | ||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||
| 642 | =over 4 | ||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||
| 644 | =item cast example 6 | ||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||
| 646 | package main; | ||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||
| 648 | use Venus::String; | ||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||
| 650 | my $string = Venus::String->new; | ||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||
| 652 | my $cast = $string->cast('number'); | ||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||
| 654 | # bless({ value => 0 }, "Venus::Float") | ||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||
| 656 | =back | ||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||
| 658 | =over 4 | ||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||
| 660 | =item cast example 7 | ||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||
| 662 | package main; | ||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||
| 664 | use Venus::String; | ||||||||||||||||||||||||||||
| 665 | |||||||||||||||||||||||||||||
| 666 | my $string = Venus::String->new; | ||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||
| 668 | my $cast = $string->cast('regexp'); | ||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||
| 670 | # bless({ value => qr/(?^u:)/ }, "Venus::Regexp") | ||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||
| 672 | =back | ||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||
| 674 | =over 4 | ||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||
| 676 | =item cast example 8 | ||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||
| 678 | package main; | ||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||
| 680 | use Venus::String; | ||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||
| 682 | my $string = Venus::String->new; | ||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||
| 684 | my $cast = $string->cast('scalar'); | ||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||
| 686 | # bless({ value => \"" }, "Venus::Scalar") | ||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||
| 688 | =back | ||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||
| 690 | =over 4 | ||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||
| 692 | =item cast example 9 | ||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||
| 694 | package main; | ||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||
| 696 | use Venus::String; | ||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||
| 698 | my $string = Venus::String->new; | ||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||
| 700 | my $cast = $string->cast('string'); | ||||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||
| 702 | # bless({ value => "" }, "Venus::String") | ||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||
| 704 | =back | ||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||
| 706 | =over 4 | ||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||
| 708 | =item cast example 10 | ||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||
| 710 | package main; | ||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||
| 712 | use Venus::String; | ||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||
| 714 | my $string = Venus::String->new; | ||||||||||||||||||||||||||||
| 715 | |||||||||||||||||||||||||||||
| 716 | my $cast = $string->cast('undef'); | ||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||
| 718 | # bless({ value => undef }, "Venus::Undef") | ||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||
| 720 | =back | ||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||
| 722 | =cut | ||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||
| 724 | =head2 chomp | ||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||
| 726 | chomp() (string) | ||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||
| 728 | The chomp method removes the newline (or the current value of $/) from the end | ||||||||||||||||||||||||||||
| 729 | of the string. | ||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||
| 731 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||
| 733 | =over 4 | ||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||
| 735 | =item chomp example 1 | ||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||
| 737 | package main; | ||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||
| 739 | use Venus::String; | ||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||
| 741 | my $string = Venus::String->new("name, age, dob, email\n"); | ||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||
| 743 | my $chomp = $string->chomp; | ||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||
| 745 | # "name, age, dob, email" | ||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||
| 747 | =back | ||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||
| 749 | =over 4 | ||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||
| 751 | =item chomp example 2 | ||||||||||||||||||||||||||||
| 752 | |||||||||||||||||||||||||||||
| 753 | package main; | ||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||
| 755 | use Venus::String; | ||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||
| 757 | my $string = Venus::String->new("name, age, dob, email\n\n"); | ||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||
| 759 | my $chomp = $string->chomp; | ||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||
| 761 | # "name, age, dob, email\n" | ||||||||||||||||||||||||||||
| 762 | |||||||||||||||||||||||||||||
| 763 | =back | ||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||
| 765 | =cut | ||||||||||||||||||||||||||||
| 766 | |||||||||||||||||||||||||||||
| 767 | =head2 chop | ||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||
| 769 | chop() (string) | ||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||
| 771 | The chop method removes and returns the last character of the string. | ||||||||||||||||||||||||||||
| 772 | |||||||||||||||||||||||||||||
| 773 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 774 | |||||||||||||||||||||||||||||
| 775 | =over 4 | ||||||||||||||||||||||||||||
| 776 | |||||||||||||||||||||||||||||
| 777 | =item chop example 1 | ||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||
| 779 | package main; | ||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||
| 781 | use Venus::String; | ||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||
| 783 | my $string = Venus::String->new("this is just a test."); | ||||||||||||||||||||||||||||
| 784 | |||||||||||||||||||||||||||||
| 785 | my $chop = $string->chop; | ||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||
| 787 | # "this is just a test" | ||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||
| 789 | =back | ||||||||||||||||||||||||||||
| 790 | |||||||||||||||||||||||||||||
| 791 | =cut | ||||||||||||||||||||||||||||
| 792 | |||||||||||||||||||||||||||||
| 793 | =head2 concat | ||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||
| 795 | concat(string @parts) (string) | ||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||
| 797 | The concat method returns the string with the argument list appended to it. | ||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||
| 799 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||
| 801 | =over 4 | ||||||||||||||||||||||||||||
| 802 | |||||||||||||||||||||||||||||
| 803 | =item concat example 1 | ||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||
| 805 | package main; | ||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||
| 807 | use Venus::String; | ||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||
| 809 | my $string = Venus::String->new('ABC'); | ||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||
| 811 | my $concat = $string->concat('DEF', 'GHI'); | ||||||||||||||||||||||||||||
| 812 | |||||||||||||||||||||||||||||
| 813 | # "ABCDEFGHI" | ||||||||||||||||||||||||||||
| 814 | |||||||||||||||||||||||||||||
| 815 | =back | ||||||||||||||||||||||||||||
| 816 | |||||||||||||||||||||||||||||
| 817 | =cut | ||||||||||||||||||||||||||||
| 818 | |||||||||||||||||||||||||||||
| 819 | =head2 contains | ||||||||||||||||||||||||||||
| 820 | |||||||||||||||||||||||||||||
| 821 | contains(string $expr) (boolean) | ||||||||||||||||||||||||||||
| 822 | |||||||||||||||||||||||||||||
| 823 | The contains method searches the string for a substring or expression returns | ||||||||||||||||||||||||||||
| 824 | true or false if found. | ||||||||||||||||||||||||||||
| 825 | |||||||||||||||||||||||||||||
| 826 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||
| 828 | =over 4 | ||||||||||||||||||||||||||||
| 829 | |||||||||||||||||||||||||||||
| 830 | =item contains example 1 | ||||||||||||||||||||||||||||
| 831 | |||||||||||||||||||||||||||||
| 832 | package main; | ||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||
| 834 | use Venus::String; | ||||||||||||||||||||||||||||
| 835 | |||||||||||||||||||||||||||||
| 836 | my $string = Venus::String->new('Nullam ultrices placerat.'); | ||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||
| 838 | my $contains = $string->contains('trices'); | ||||||||||||||||||||||||||||
| 839 | |||||||||||||||||||||||||||||
| 840 | # 1 | ||||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||
| 842 | =back | ||||||||||||||||||||||||||||
| 843 | |||||||||||||||||||||||||||||
| 844 | =over 4 | ||||||||||||||||||||||||||||
| 845 | |||||||||||||||||||||||||||||
| 846 | =item contains example 2 | ||||||||||||||||||||||||||||
| 847 | |||||||||||||||||||||||||||||
| 848 | package main; | ||||||||||||||||||||||||||||
| 849 | |||||||||||||||||||||||||||||
| 850 | use Venus::String; | ||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||
| 852 | my $string = Venus::String->new('Nullam ultrices placerat.'); | ||||||||||||||||||||||||||||
| 853 | |||||||||||||||||||||||||||||
| 854 | my $contains = $string->contains('itrices'); | ||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||
| 856 | # 0 | ||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||
| 858 | =back | ||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||
| 860 | =over 4 | ||||||||||||||||||||||||||||
| 861 | |||||||||||||||||||||||||||||
| 862 | =item contains example 3 | ||||||||||||||||||||||||||||
| 863 | |||||||||||||||||||||||||||||
| 864 | package main; | ||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||
| 866 | use Venus::String; | ||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||
| 868 | my $string = Venus::String->new('Nullam ultrices placerat.'); | ||||||||||||||||||||||||||||
| 869 | |||||||||||||||||||||||||||||
| 870 | my $contains = $string->contains(qr/trices/); | ||||||||||||||||||||||||||||
| 871 | |||||||||||||||||||||||||||||
| 872 | # 1 | ||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||
| 874 | =back | ||||||||||||||||||||||||||||
| 875 | |||||||||||||||||||||||||||||
| 876 | =cut | ||||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||
| 878 | =head2 default | ||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||
| 880 | default() (string) | ||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||
| 882 | The default method returns the default value, i.e. C<''>. | ||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||
| 884 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||
| 886 | =over 4 | ||||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||
| 888 | =item default example 1 | ||||||||||||||||||||||||||||
| 889 | |||||||||||||||||||||||||||||
| 890 | # given: synopsis; | ||||||||||||||||||||||||||||
| 891 | |||||||||||||||||||||||||||||
| 892 | my $default = $string->default; | ||||||||||||||||||||||||||||
| 893 | |||||||||||||||||||||||||||||
| 894 | # "" | ||||||||||||||||||||||||||||
| 895 | |||||||||||||||||||||||||||||
| 896 | =back | ||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||
| 898 | =cut | ||||||||||||||||||||||||||||
| 899 | |||||||||||||||||||||||||||||
| 900 | =head2 eq | ||||||||||||||||||||||||||||
| 901 | |||||||||||||||||||||||||||||
| 902 | eq(any $arg) (boolean) | ||||||||||||||||||||||||||||
| 903 | |||||||||||||||||||||||||||||
| 904 | The eq method performs an I<"equals"> operation using the argument provided. | ||||||||||||||||||||||||||||
| 905 | |||||||||||||||||||||||||||||
| 906 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 907 | |||||||||||||||||||||||||||||
| 908 | =over 4 | ||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||
| 910 | =item eq example 1 | ||||||||||||||||||||||||||||
| 911 | |||||||||||||||||||||||||||||
| 912 | package main; | ||||||||||||||||||||||||||||
| 913 | |||||||||||||||||||||||||||||
| 914 | use Venus::Array; | ||||||||||||||||||||||||||||
| 915 | use Venus::String; | ||||||||||||||||||||||||||||
| 916 | |||||||||||||||||||||||||||||
| 917 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 918 | my $rvalue = Venus::Array->new; | ||||||||||||||||||||||||||||
| 919 | |||||||||||||||||||||||||||||
| 920 | my $result = $lvalue->eq($rvalue); | ||||||||||||||||||||||||||||
| 921 | |||||||||||||||||||||||||||||
| 922 | # 0 | ||||||||||||||||||||||||||||
| 923 | |||||||||||||||||||||||||||||
| 924 | =back | ||||||||||||||||||||||||||||
| 925 | |||||||||||||||||||||||||||||
| 926 | =over 4 | ||||||||||||||||||||||||||||
| 927 | |||||||||||||||||||||||||||||
| 928 | =item eq example 2 | ||||||||||||||||||||||||||||
| 929 | |||||||||||||||||||||||||||||
| 930 | package main; | ||||||||||||||||||||||||||||
| 931 | |||||||||||||||||||||||||||||
| 932 | use Venus::Code; | ||||||||||||||||||||||||||||
| 933 | use Venus::String; | ||||||||||||||||||||||||||||
| 934 | |||||||||||||||||||||||||||||
| 935 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 936 | my $rvalue = Venus::Code->new; | ||||||||||||||||||||||||||||
| 937 | |||||||||||||||||||||||||||||
| 938 | my $result = $lvalue->eq($rvalue); | ||||||||||||||||||||||||||||
| 939 | |||||||||||||||||||||||||||||
| 940 | # 0 | ||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||
| 942 | =back | ||||||||||||||||||||||||||||
| 943 | |||||||||||||||||||||||||||||
| 944 | =over 4 | ||||||||||||||||||||||||||||
| 945 | |||||||||||||||||||||||||||||
| 946 | =item eq example 3 | ||||||||||||||||||||||||||||
| 947 | |||||||||||||||||||||||||||||
| 948 | package main; | ||||||||||||||||||||||||||||
| 949 | |||||||||||||||||||||||||||||
| 950 | use Venus::Float; | ||||||||||||||||||||||||||||
| 951 | use Venus::String; | ||||||||||||||||||||||||||||
| 952 | |||||||||||||||||||||||||||||
| 953 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 954 | my $rvalue = Venus::Float->new; | ||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||
| 956 | my $result = $lvalue->eq($rvalue); | ||||||||||||||||||||||||||||
| 957 | |||||||||||||||||||||||||||||
| 958 | # 0 | ||||||||||||||||||||||||||||
| 959 | |||||||||||||||||||||||||||||
| 960 | =back | ||||||||||||||||||||||||||||
| 961 | |||||||||||||||||||||||||||||
| 962 | =over 4 | ||||||||||||||||||||||||||||
| 963 | |||||||||||||||||||||||||||||
| 964 | =item eq example 4 | ||||||||||||||||||||||||||||
| 965 | |||||||||||||||||||||||||||||
| 966 | package main; | ||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||
| 968 | use Venus::Hash; | ||||||||||||||||||||||||||||
| 969 | use Venus::String; | ||||||||||||||||||||||||||||
| 970 | |||||||||||||||||||||||||||||
| 971 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 972 | my $rvalue = Venus::Hash->new; | ||||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||
| 974 | my $result = $lvalue->eq($rvalue); | ||||||||||||||||||||||||||||
| 975 | |||||||||||||||||||||||||||||
| 976 | # 0 | ||||||||||||||||||||||||||||
| 977 | |||||||||||||||||||||||||||||
| 978 | =back | ||||||||||||||||||||||||||||
| 979 | |||||||||||||||||||||||||||||
| 980 | =over 4 | ||||||||||||||||||||||||||||
| 981 | |||||||||||||||||||||||||||||
| 982 | =item eq example 5 | ||||||||||||||||||||||||||||
| 983 | |||||||||||||||||||||||||||||
| 984 | package main; | ||||||||||||||||||||||||||||
| 985 | |||||||||||||||||||||||||||||
| 986 | use Venus::Number; | ||||||||||||||||||||||||||||
| 987 | use Venus::String; | ||||||||||||||||||||||||||||
| 988 | |||||||||||||||||||||||||||||
| 989 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 990 | my $rvalue = Venus::Number->new; | ||||||||||||||||||||||||||||
| 991 | |||||||||||||||||||||||||||||
| 992 | my $result = $lvalue->eq($rvalue); | ||||||||||||||||||||||||||||
| 993 | |||||||||||||||||||||||||||||
| 994 | # 0 | ||||||||||||||||||||||||||||
| 995 | |||||||||||||||||||||||||||||
| 996 | =back | ||||||||||||||||||||||||||||
| 997 | |||||||||||||||||||||||||||||
| 998 | =over 4 | ||||||||||||||||||||||||||||
| 999 | |||||||||||||||||||||||||||||
| 1000 | =item eq example 6 | ||||||||||||||||||||||||||||
| 1001 | |||||||||||||||||||||||||||||
| 1002 | package main; | ||||||||||||||||||||||||||||
| 1003 | |||||||||||||||||||||||||||||
| 1004 | use Venus::Regexp; | ||||||||||||||||||||||||||||
| 1005 | use Venus::String; | ||||||||||||||||||||||||||||
| 1006 | |||||||||||||||||||||||||||||
| 1007 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1008 | my $rvalue = Venus::Regexp->new; | ||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||
| 1010 | my $result = $lvalue->eq($rvalue); | ||||||||||||||||||||||||||||
| 1011 | |||||||||||||||||||||||||||||
| 1012 | # 0 | ||||||||||||||||||||||||||||
| 1013 | |||||||||||||||||||||||||||||
| 1014 | =back | ||||||||||||||||||||||||||||
| 1015 | |||||||||||||||||||||||||||||
| 1016 | =over 4 | ||||||||||||||||||||||||||||
| 1017 | |||||||||||||||||||||||||||||
| 1018 | =item eq example 7 | ||||||||||||||||||||||||||||
| 1019 | |||||||||||||||||||||||||||||
| 1020 | package main; | ||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||
| 1022 | use Venus::Scalar; | ||||||||||||||||||||||||||||
| 1023 | use Venus::String; | ||||||||||||||||||||||||||||
| 1024 | |||||||||||||||||||||||||||||
| 1025 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1026 | my $rvalue = Venus::Scalar->new; | ||||||||||||||||||||||||||||
| 1027 | |||||||||||||||||||||||||||||
| 1028 | my $result = $lvalue->eq($rvalue); | ||||||||||||||||||||||||||||
| 1029 | |||||||||||||||||||||||||||||
| 1030 | # 0 | ||||||||||||||||||||||||||||
| 1031 | |||||||||||||||||||||||||||||
| 1032 | =back | ||||||||||||||||||||||||||||
| 1033 | |||||||||||||||||||||||||||||
| 1034 | =over 4 | ||||||||||||||||||||||||||||
| 1035 | |||||||||||||||||||||||||||||
| 1036 | =item eq example 8 | ||||||||||||||||||||||||||||
| 1037 | |||||||||||||||||||||||||||||
| 1038 | package main; | ||||||||||||||||||||||||||||
| 1039 | |||||||||||||||||||||||||||||
| 1040 | use Venus::String; | ||||||||||||||||||||||||||||
| 1041 | |||||||||||||||||||||||||||||
| 1042 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1043 | my $rvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1044 | |||||||||||||||||||||||||||||
| 1045 | my $result = $lvalue->eq($rvalue); | ||||||||||||||||||||||||||||
| 1046 | |||||||||||||||||||||||||||||
| 1047 | # 1 | ||||||||||||||||||||||||||||
| 1048 | |||||||||||||||||||||||||||||
| 1049 | =back | ||||||||||||||||||||||||||||
| 1050 | |||||||||||||||||||||||||||||
| 1051 | =over 4 | ||||||||||||||||||||||||||||
| 1052 | |||||||||||||||||||||||||||||
| 1053 | =item eq example 9 | ||||||||||||||||||||||||||||
| 1054 | |||||||||||||||||||||||||||||
| 1055 | package main; | ||||||||||||||||||||||||||||
| 1056 | |||||||||||||||||||||||||||||
| 1057 | use Venus::String; | ||||||||||||||||||||||||||||
| 1058 | use Venus::Undef; | ||||||||||||||||||||||||||||
| 1059 | |||||||||||||||||||||||||||||
| 1060 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1061 | my $rvalue = Venus::Undef->new; | ||||||||||||||||||||||||||||
| 1062 | |||||||||||||||||||||||||||||
| 1063 | my $result = $lvalue->eq($rvalue); | ||||||||||||||||||||||||||||
| 1064 | |||||||||||||||||||||||||||||
| 1065 | # 1 | ||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||
| 1067 | =back | ||||||||||||||||||||||||||||
| 1068 | |||||||||||||||||||||||||||||
| 1069 | =cut | ||||||||||||||||||||||||||||
| 1070 | |||||||||||||||||||||||||||||
| 1071 | =head2 format | ||||||||||||||||||||||||||||
| 1072 | |||||||||||||||||||||||||||||
| 1073 | format(any @args) (string) | ||||||||||||||||||||||||||||
| 1074 | |||||||||||||||||||||||||||||
| 1075 | The format method performs a L<perlfunc/sprintf> operation using the underlying | ||||||||||||||||||||||||||||
| 1076 | string and arguments provided and returns the result. | ||||||||||||||||||||||||||||
| 1077 | |||||||||||||||||||||||||||||
| 1078 | I<Since C<3.30>> | ||||||||||||||||||||||||||||
| 1079 | |||||||||||||||||||||||||||||
| 1080 | =over 4 | ||||||||||||||||||||||||||||
| 1081 | |||||||||||||||||||||||||||||
| 1082 | =item format example 1 | ||||||||||||||||||||||||||||
| 1083 | |||||||||||||||||||||||||||||
| 1084 | package main; | ||||||||||||||||||||||||||||
| 1085 | |||||||||||||||||||||||||||||
| 1086 | use Venus::String; | ||||||||||||||||||||||||||||
| 1087 | |||||||||||||||||||||||||||||
| 1088 | my $string = Venus::String->new('hello %s'); | ||||||||||||||||||||||||||||
| 1089 | |||||||||||||||||||||||||||||
| 1090 | my $format = $string->format('world'); | ||||||||||||||||||||||||||||
| 1091 | |||||||||||||||||||||||||||||
| 1092 | # "hello world" | ||||||||||||||||||||||||||||
| 1093 | |||||||||||||||||||||||||||||
| 1094 | =back | ||||||||||||||||||||||||||||
| 1095 | |||||||||||||||||||||||||||||
| 1096 | =over 4 | ||||||||||||||||||||||||||||
| 1097 | |||||||||||||||||||||||||||||
| 1098 | =item format example 2 | ||||||||||||||||||||||||||||
| 1099 | |||||||||||||||||||||||||||||
| 1100 | package main; | ||||||||||||||||||||||||||||
| 1101 | |||||||||||||||||||||||||||||
| 1102 | use Venus::String; | ||||||||||||||||||||||||||||
| 1103 | |||||||||||||||||||||||||||||
| 1104 | my $string = Venus::String->new('id number %08d'); | ||||||||||||||||||||||||||||
| 1105 | |||||||||||||||||||||||||||||
| 1106 | my $format = $string->format(10); | ||||||||||||||||||||||||||||
| 1107 | |||||||||||||||||||||||||||||
| 1108 | # "id number 00000010" | ||||||||||||||||||||||||||||
| 1109 | |||||||||||||||||||||||||||||
| 1110 | =back | ||||||||||||||||||||||||||||
| 1111 | |||||||||||||||||||||||||||||
| 1112 | =cut | ||||||||||||||||||||||||||||
| 1113 | |||||||||||||||||||||||||||||
| 1114 | =head2 ge | ||||||||||||||||||||||||||||
| 1115 | |||||||||||||||||||||||||||||
| 1116 | ge(any $arg) (boolean) | ||||||||||||||||||||||||||||
| 1117 | |||||||||||||||||||||||||||||
| 1118 | The ge method performs a I<"greater-than-or-equal-to"> operation using the | ||||||||||||||||||||||||||||
| 1119 | argument provided. | ||||||||||||||||||||||||||||
| 1120 | |||||||||||||||||||||||||||||
| 1121 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 1122 | |||||||||||||||||||||||||||||
| 1123 | =over 4 | ||||||||||||||||||||||||||||
| 1124 | |||||||||||||||||||||||||||||
| 1125 | =item ge example 1 | ||||||||||||||||||||||||||||
| 1126 | |||||||||||||||||||||||||||||
| 1127 | package main; | ||||||||||||||||||||||||||||
| 1128 | |||||||||||||||||||||||||||||
| 1129 | use Venus::Array; | ||||||||||||||||||||||||||||
| 1130 | use Venus::String; | ||||||||||||||||||||||||||||
| 1131 | |||||||||||||||||||||||||||||
| 1132 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1133 | my $rvalue = Venus::Array->new; | ||||||||||||||||||||||||||||
| 1134 | |||||||||||||||||||||||||||||
| 1135 | my $result = $lvalue->ge($rvalue); | ||||||||||||||||||||||||||||
| 1136 | |||||||||||||||||||||||||||||
| 1137 | # 0 | ||||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||
| 1139 | =back | ||||||||||||||||||||||||||||
| 1140 | |||||||||||||||||||||||||||||
| 1141 | =over 4 | ||||||||||||||||||||||||||||
| 1142 | |||||||||||||||||||||||||||||
| 1143 | =item ge example 2 | ||||||||||||||||||||||||||||
| 1144 | |||||||||||||||||||||||||||||
| 1145 | package main; | ||||||||||||||||||||||||||||
| 1146 | |||||||||||||||||||||||||||||
| 1147 | use Venus::Code; | ||||||||||||||||||||||||||||
| 1148 | use Venus::String; | ||||||||||||||||||||||||||||
| 1149 | |||||||||||||||||||||||||||||
| 1150 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1151 | my $rvalue = Venus::Code->new; | ||||||||||||||||||||||||||||
| 1152 | |||||||||||||||||||||||||||||
| 1153 | my $result = $lvalue->ge($rvalue); | ||||||||||||||||||||||||||||
| 1154 | |||||||||||||||||||||||||||||
| 1155 | # 0 | ||||||||||||||||||||||||||||
| 1156 | |||||||||||||||||||||||||||||
| 1157 | =back | ||||||||||||||||||||||||||||
| 1158 | |||||||||||||||||||||||||||||
| 1159 | =over 4 | ||||||||||||||||||||||||||||
| 1160 | |||||||||||||||||||||||||||||
| 1161 | =item ge example 3 | ||||||||||||||||||||||||||||
| 1162 | |||||||||||||||||||||||||||||
| 1163 | package main; | ||||||||||||||||||||||||||||
| 1164 | |||||||||||||||||||||||||||||
| 1165 | use Venus::Float; | ||||||||||||||||||||||||||||
| 1166 | use Venus::String; | ||||||||||||||||||||||||||||
| 1167 | |||||||||||||||||||||||||||||
| 1168 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1169 | my $rvalue = Venus::Float->new; | ||||||||||||||||||||||||||||
| 1170 | |||||||||||||||||||||||||||||
| 1171 | my $result = $lvalue->ge($rvalue); | ||||||||||||||||||||||||||||
| 1172 | |||||||||||||||||||||||||||||
| 1173 | # 0 | ||||||||||||||||||||||||||||
| 1174 | |||||||||||||||||||||||||||||
| 1175 | =back | ||||||||||||||||||||||||||||
| 1176 | |||||||||||||||||||||||||||||
| 1177 | =over 4 | ||||||||||||||||||||||||||||
| 1178 | |||||||||||||||||||||||||||||
| 1179 | =item ge example 4 | ||||||||||||||||||||||||||||
| 1180 | |||||||||||||||||||||||||||||
| 1181 | package main; | ||||||||||||||||||||||||||||
| 1182 | |||||||||||||||||||||||||||||
| 1183 | use Venus::Hash; | ||||||||||||||||||||||||||||
| 1184 | use Venus::String; | ||||||||||||||||||||||||||||
| 1185 | |||||||||||||||||||||||||||||
| 1186 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1187 | my $rvalue = Venus::Hash->new; | ||||||||||||||||||||||||||||
| 1188 | |||||||||||||||||||||||||||||
| 1189 | my $result = $lvalue->ge($rvalue); | ||||||||||||||||||||||||||||
| 1190 | |||||||||||||||||||||||||||||
| 1191 | # 0 | ||||||||||||||||||||||||||||
| 1192 | |||||||||||||||||||||||||||||
| 1193 | =back | ||||||||||||||||||||||||||||
| 1194 | |||||||||||||||||||||||||||||
| 1195 | =over 4 | ||||||||||||||||||||||||||||
| 1196 | |||||||||||||||||||||||||||||
| 1197 | =item ge example 5 | ||||||||||||||||||||||||||||
| 1198 | |||||||||||||||||||||||||||||
| 1199 | package main; | ||||||||||||||||||||||||||||
| 1200 | |||||||||||||||||||||||||||||
| 1201 | use Venus::Number; | ||||||||||||||||||||||||||||
| 1202 | use Venus::String; | ||||||||||||||||||||||||||||
| 1203 | |||||||||||||||||||||||||||||
| 1204 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1205 | my $rvalue = Venus::Number->new; | ||||||||||||||||||||||||||||
| 1206 | |||||||||||||||||||||||||||||
| 1207 | my $result = $lvalue->ge($rvalue); | ||||||||||||||||||||||||||||
| 1208 | |||||||||||||||||||||||||||||
| 1209 | # 0 | ||||||||||||||||||||||||||||
| 1210 | |||||||||||||||||||||||||||||
| 1211 | =back | ||||||||||||||||||||||||||||
| 1212 | |||||||||||||||||||||||||||||
| 1213 | =over 4 | ||||||||||||||||||||||||||||
| 1214 | |||||||||||||||||||||||||||||
| 1215 | =item ge example 6 | ||||||||||||||||||||||||||||
| 1216 | |||||||||||||||||||||||||||||
| 1217 | package main; | ||||||||||||||||||||||||||||
| 1218 | |||||||||||||||||||||||||||||
| 1219 | use Venus::Regexp; | ||||||||||||||||||||||||||||
| 1220 | use Venus::String; | ||||||||||||||||||||||||||||
| 1221 | |||||||||||||||||||||||||||||
| 1222 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1223 | my $rvalue = Venus::Regexp->new; | ||||||||||||||||||||||||||||
| 1224 | |||||||||||||||||||||||||||||
| 1225 | my $result = $lvalue->ge($rvalue); | ||||||||||||||||||||||||||||
| 1226 | |||||||||||||||||||||||||||||
| 1227 | # 0 | ||||||||||||||||||||||||||||
| 1228 | |||||||||||||||||||||||||||||
| 1229 | =back | ||||||||||||||||||||||||||||
| 1230 | |||||||||||||||||||||||||||||
| 1231 | =over 4 | ||||||||||||||||||||||||||||
| 1232 | |||||||||||||||||||||||||||||
| 1233 | =item ge example 7 | ||||||||||||||||||||||||||||
| 1234 | |||||||||||||||||||||||||||||
| 1235 | package main; | ||||||||||||||||||||||||||||
| 1236 | |||||||||||||||||||||||||||||
| 1237 | use Venus::Scalar; | ||||||||||||||||||||||||||||
| 1238 | use Venus::String; | ||||||||||||||||||||||||||||
| 1239 | |||||||||||||||||||||||||||||
| 1240 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1241 | my $rvalue = Venus::Scalar->new; | ||||||||||||||||||||||||||||
| 1242 | |||||||||||||||||||||||||||||
| 1243 | my $result = $lvalue->ge($rvalue); | ||||||||||||||||||||||||||||
| 1244 | |||||||||||||||||||||||||||||
| 1245 | # 0 | ||||||||||||||||||||||||||||
| 1246 | |||||||||||||||||||||||||||||
| 1247 | =back | ||||||||||||||||||||||||||||
| 1248 | |||||||||||||||||||||||||||||
| 1249 | =over 4 | ||||||||||||||||||||||||||||
| 1250 | |||||||||||||||||||||||||||||
| 1251 | =item ge example 8 | ||||||||||||||||||||||||||||
| 1252 | |||||||||||||||||||||||||||||
| 1253 | package main; | ||||||||||||||||||||||||||||
| 1254 | |||||||||||||||||||||||||||||
| 1255 | use Venus::String; | ||||||||||||||||||||||||||||
| 1256 | |||||||||||||||||||||||||||||
| 1257 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1258 | my $rvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1259 | |||||||||||||||||||||||||||||
| 1260 | my $result = $lvalue->ge($rvalue); | ||||||||||||||||||||||||||||
| 1261 | |||||||||||||||||||||||||||||
| 1262 | # 1 | ||||||||||||||||||||||||||||
| 1263 | |||||||||||||||||||||||||||||
| 1264 | =back | ||||||||||||||||||||||||||||
| 1265 | |||||||||||||||||||||||||||||
| 1266 | =over 4 | ||||||||||||||||||||||||||||
| 1267 | |||||||||||||||||||||||||||||
| 1268 | =item ge example 9 | ||||||||||||||||||||||||||||
| 1269 | |||||||||||||||||||||||||||||
| 1270 | package main; | ||||||||||||||||||||||||||||
| 1271 | |||||||||||||||||||||||||||||
| 1272 | use Venus::String; | ||||||||||||||||||||||||||||
| 1273 | use Venus::Undef; | ||||||||||||||||||||||||||||
| 1274 | |||||||||||||||||||||||||||||
| 1275 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1276 | my $rvalue = Venus::Undef->new; | ||||||||||||||||||||||||||||
| 1277 | |||||||||||||||||||||||||||||
| 1278 | my $result = $lvalue->ge($rvalue); | ||||||||||||||||||||||||||||
| 1279 | |||||||||||||||||||||||||||||
| 1280 | # 1 | ||||||||||||||||||||||||||||
| 1281 | |||||||||||||||||||||||||||||
| 1282 | =back | ||||||||||||||||||||||||||||
| 1283 | |||||||||||||||||||||||||||||
| 1284 | =cut | ||||||||||||||||||||||||||||
| 1285 | |||||||||||||||||||||||||||||
| 1286 | =head2 gele | ||||||||||||||||||||||||||||
| 1287 | |||||||||||||||||||||||||||||
| 1288 | gele(any $arg1, any $arg2) (boolean) | ||||||||||||||||||||||||||||
| 1289 | |||||||||||||||||||||||||||||
| 1290 | The gele method performs a I<"greater-than-or-equal-to"> operation on the 1st | ||||||||||||||||||||||||||||
| 1291 | argument, and I<"lesser-than-or-equal-to"> operation on the 2nd argument. | ||||||||||||||||||||||||||||
| 1292 | |||||||||||||||||||||||||||||
| 1293 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 1294 | |||||||||||||||||||||||||||||
| 1295 | =over 4 | ||||||||||||||||||||||||||||
| 1296 | |||||||||||||||||||||||||||||
| 1297 | =item gele example 1 | ||||||||||||||||||||||||||||
| 1298 | |||||||||||||||||||||||||||||
| 1299 | package main; | ||||||||||||||||||||||||||||
| 1300 | |||||||||||||||||||||||||||||
| 1301 | use Venus::Array; | ||||||||||||||||||||||||||||
| 1302 | use Venus::String; | ||||||||||||||||||||||||||||
| 1303 | |||||||||||||||||||||||||||||
| 1304 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1305 | my $rvalue = Venus::Array->new; | ||||||||||||||||||||||||||||
| 1306 | |||||||||||||||||||||||||||||
| 1307 | my $result = $lvalue->gele($rvalue); | ||||||||||||||||||||||||||||
| 1308 | |||||||||||||||||||||||||||||
| 1309 | # 0 | ||||||||||||||||||||||||||||
| 1310 | |||||||||||||||||||||||||||||
| 1311 | =back | ||||||||||||||||||||||||||||
| 1312 | |||||||||||||||||||||||||||||
| 1313 | =over 4 | ||||||||||||||||||||||||||||
| 1314 | |||||||||||||||||||||||||||||
| 1315 | =item gele example 2 | ||||||||||||||||||||||||||||
| 1316 | |||||||||||||||||||||||||||||
| 1317 | package main; | ||||||||||||||||||||||||||||
| 1318 | |||||||||||||||||||||||||||||
| 1319 | use Venus::Code; | ||||||||||||||||||||||||||||
| 1320 | use Venus::String; | ||||||||||||||||||||||||||||
| 1321 | |||||||||||||||||||||||||||||
| 1322 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1323 | my $rvalue = Venus::Code->new; | ||||||||||||||||||||||||||||
| 1324 | |||||||||||||||||||||||||||||
| 1325 | my $result = $lvalue->gele($rvalue); | ||||||||||||||||||||||||||||
| 1326 | |||||||||||||||||||||||||||||
| 1327 | # 0 | ||||||||||||||||||||||||||||
| 1328 | |||||||||||||||||||||||||||||
| 1329 | =back | ||||||||||||||||||||||||||||
| 1330 | |||||||||||||||||||||||||||||
| 1331 | =over 4 | ||||||||||||||||||||||||||||
| 1332 | |||||||||||||||||||||||||||||
| 1333 | =item gele example 3 | ||||||||||||||||||||||||||||
| 1334 | |||||||||||||||||||||||||||||
| 1335 | package main; | ||||||||||||||||||||||||||||
| 1336 | |||||||||||||||||||||||||||||
| 1337 | use Venus::Float; | ||||||||||||||||||||||||||||
| 1338 | use Venus::String; | ||||||||||||||||||||||||||||
| 1339 | |||||||||||||||||||||||||||||
| 1340 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1341 | my $rvalue = Venus::Float->new; | ||||||||||||||||||||||||||||
| 1342 | |||||||||||||||||||||||||||||
| 1343 | my $result = $lvalue->gele($rvalue); | ||||||||||||||||||||||||||||
| 1344 | |||||||||||||||||||||||||||||
| 1345 | # 0 | ||||||||||||||||||||||||||||
| 1346 | |||||||||||||||||||||||||||||
| 1347 | =back | ||||||||||||||||||||||||||||
| 1348 | |||||||||||||||||||||||||||||
| 1349 | =over 4 | ||||||||||||||||||||||||||||
| 1350 | |||||||||||||||||||||||||||||
| 1351 | =item gele example 4 | ||||||||||||||||||||||||||||
| 1352 | |||||||||||||||||||||||||||||
| 1353 | package main; | ||||||||||||||||||||||||||||
| 1354 | |||||||||||||||||||||||||||||
| 1355 | use Venus::Hash; | ||||||||||||||||||||||||||||
| 1356 | use Venus::String; | ||||||||||||||||||||||||||||
| 1357 | |||||||||||||||||||||||||||||
| 1358 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1359 | my $rvalue = Venus::Hash->new; | ||||||||||||||||||||||||||||
| 1360 | |||||||||||||||||||||||||||||
| 1361 | my $result = $lvalue->gele($rvalue); | ||||||||||||||||||||||||||||
| 1362 | |||||||||||||||||||||||||||||
| 1363 | # 0 | ||||||||||||||||||||||||||||
| 1364 | |||||||||||||||||||||||||||||
| 1365 | =back | ||||||||||||||||||||||||||||
| 1366 | |||||||||||||||||||||||||||||
| 1367 | =over 4 | ||||||||||||||||||||||||||||
| 1368 | |||||||||||||||||||||||||||||
| 1369 | =item gele example 5 | ||||||||||||||||||||||||||||
| 1370 | |||||||||||||||||||||||||||||
| 1371 | package main; | ||||||||||||||||||||||||||||
| 1372 | |||||||||||||||||||||||||||||
| 1373 | use Venus::Number; | ||||||||||||||||||||||||||||
| 1374 | use Venus::String; | ||||||||||||||||||||||||||||
| 1375 | |||||||||||||||||||||||||||||
| 1376 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1377 | my $rvalue = Venus::Number->new; | ||||||||||||||||||||||||||||
| 1378 | |||||||||||||||||||||||||||||
| 1379 | my $result = $lvalue->gele($rvalue); | ||||||||||||||||||||||||||||
| 1380 | |||||||||||||||||||||||||||||
| 1381 | # 0 | ||||||||||||||||||||||||||||
| 1382 | |||||||||||||||||||||||||||||
| 1383 | =back | ||||||||||||||||||||||||||||
| 1384 | |||||||||||||||||||||||||||||
| 1385 | =over 4 | ||||||||||||||||||||||||||||
| 1386 | |||||||||||||||||||||||||||||
| 1387 | =item gele example 6 | ||||||||||||||||||||||||||||
| 1388 | |||||||||||||||||||||||||||||
| 1389 | package main; | ||||||||||||||||||||||||||||
| 1390 | |||||||||||||||||||||||||||||
| 1391 | use Venus::Regexp; | ||||||||||||||||||||||||||||
| 1392 | use Venus::String; | ||||||||||||||||||||||||||||
| 1393 | |||||||||||||||||||||||||||||
| 1394 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1395 | my $rvalue = Venus::Regexp->new; | ||||||||||||||||||||||||||||
| 1396 | |||||||||||||||||||||||||||||
| 1397 | my $result = $lvalue->gele($rvalue); | ||||||||||||||||||||||||||||
| 1398 | |||||||||||||||||||||||||||||
| 1399 | # 0 | ||||||||||||||||||||||||||||
| 1400 | |||||||||||||||||||||||||||||
| 1401 | =back | ||||||||||||||||||||||||||||
| 1402 | |||||||||||||||||||||||||||||
| 1403 | =over 4 | ||||||||||||||||||||||||||||
| 1404 | |||||||||||||||||||||||||||||
| 1405 | =item gele example 7 | ||||||||||||||||||||||||||||
| 1406 | |||||||||||||||||||||||||||||
| 1407 | package main; | ||||||||||||||||||||||||||||
| 1408 | |||||||||||||||||||||||||||||
| 1409 | use Venus::Scalar; | ||||||||||||||||||||||||||||
| 1410 | use Venus::String; | ||||||||||||||||||||||||||||
| 1411 | |||||||||||||||||||||||||||||
| 1412 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1413 | my $rvalue = Venus::Scalar->new; | ||||||||||||||||||||||||||||
| 1414 | |||||||||||||||||||||||||||||
| 1415 | my $result = $lvalue->gele($rvalue); | ||||||||||||||||||||||||||||
| 1416 | |||||||||||||||||||||||||||||
| 1417 | # 0 | ||||||||||||||||||||||||||||
| 1418 | |||||||||||||||||||||||||||||
| 1419 | =back | ||||||||||||||||||||||||||||
| 1420 | |||||||||||||||||||||||||||||
| 1421 | =over 4 | ||||||||||||||||||||||||||||
| 1422 | |||||||||||||||||||||||||||||
| 1423 | =item gele example 8 | ||||||||||||||||||||||||||||
| 1424 | |||||||||||||||||||||||||||||
| 1425 | package main; | ||||||||||||||||||||||||||||
| 1426 | |||||||||||||||||||||||||||||
| 1427 | use Venus::String; | ||||||||||||||||||||||||||||
| 1428 | |||||||||||||||||||||||||||||
| 1429 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1430 | my $rvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1431 | |||||||||||||||||||||||||||||
| 1432 | my $result = $lvalue->gele($rvalue); | ||||||||||||||||||||||||||||
| 1433 | |||||||||||||||||||||||||||||
| 1434 | # 1 | ||||||||||||||||||||||||||||
| 1435 | |||||||||||||||||||||||||||||
| 1436 | =back | ||||||||||||||||||||||||||||
| 1437 | |||||||||||||||||||||||||||||
| 1438 | =over 4 | ||||||||||||||||||||||||||||
| 1439 | |||||||||||||||||||||||||||||
| 1440 | =item gele example 9 | ||||||||||||||||||||||||||||
| 1441 | |||||||||||||||||||||||||||||
| 1442 | package main; | ||||||||||||||||||||||||||||
| 1443 | |||||||||||||||||||||||||||||
| 1444 | use Venus::String; | ||||||||||||||||||||||||||||
| 1445 | use Venus::Undef; | ||||||||||||||||||||||||||||
| 1446 | |||||||||||||||||||||||||||||
| 1447 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1448 | my $rvalue = Venus::Undef->new; | ||||||||||||||||||||||||||||
| 1449 | |||||||||||||||||||||||||||||
| 1450 | my $result = $lvalue->gele($rvalue); | ||||||||||||||||||||||||||||
| 1451 | |||||||||||||||||||||||||||||
| 1452 | # 1 | ||||||||||||||||||||||||||||
| 1453 | |||||||||||||||||||||||||||||
| 1454 | =back | ||||||||||||||||||||||||||||
| 1455 | |||||||||||||||||||||||||||||
| 1456 | =cut | ||||||||||||||||||||||||||||
| 1457 | |||||||||||||||||||||||||||||
| 1458 | =head2 gt | ||||||||||||||||||||||||||||
| 1459 | |||||||||||||||||||||||||||||
| 1460 | gt(any $arg) (boolean) | ||||||||||||||||||||||||||||
| 1461 | |||||||||||||||||||||||||||||
| 1462 | The gt method performs a I<"greater-than"> operation using the argument provided. | ||||||||||||||||||||||||||||
| 1463 | |||||||||||||||||||||||||||||
| 1464 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 1465 | |||||||||||||||||||||||||||||
| 1466 | =over 4 | ||||||||||||||||||||||||||||
| 1467 | |||||||||||||||||||||||||||||
| 1468 | =item gt example 1 | ||||||||||||||||||||||||||||
| 1469 | |||||||||||||||||||||||||||||
| 1470 | package main; | ||||||||||||||||||||||||||||
| 1471 | |||||||||||||||||||||||||||||
| 1472 | use Venus::Array; | ||||||||||||||||||||||||||||
| 1473 | use Venus::String; | ||||||||||||||||||||||||||||
| 1474 | |||||||||||||||||||||||||||||
| 1475 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1476 | my $rvalue = Venus::Array->new; | ||||||||||||||||||||||||||||
| 1477 | |||||||||||||||||||||||||||||
| 1478 | my $result = $lvalue->gt($rvalue); | ||||||||||||||||||||||||||||
| 1479 | |||||||||||||||||||||||||||||
| 1480 | # 0 | ||||||||||||||||||||||||||||
| 1481 | |||||||||||||||||||||||||||||
| 1482 | =back | ||||||||||||||||||||||||||||
| 1483 | |||||||||||||||||||||||||||||
| 1484 | =over 4 | ||||||||||||||||||||||||||||
| 1485 | |||||||||||||||||||||||||||||
| 1486 | =item gt example 2 | ||||||||||||||||||||||||||||
| 1487 | |||||||||||||||||||||||||||||
| 1488 | package main; | ||||||||||||||||||||||||||||
| 1489 | |||||||||||||||||||||||||||||
| 1490 | use Venus::Code; | ||||||||||||||||||||||||||||
| 1491 | use Venus::String; | ||||||||||||||||||||||||||||
| 1492 | |||||||||||||||||||||||||||||
| 1493 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1494 | my $rvalue = Venus::Code->new; | ||||||||||||||||||||||||||||
| 1495 | |||||||||||||||||||||||||||||
| 1496 | my $result = $lvalue->gt($rvalue); | ||||||||||||||||||||||||||||
| 1497 | |||||||||||||||||||||||||||||
| 1498 | # 0 | ||||||||||||||||||||||||||||
| 1499 | |||||||||||||||||||||||||||||
| 1500 | =back | ||||||||||||||||||||||||||||
| 1501 | |||||||||||||||||||||||||||||
| 1502 | =over 4 | ||||||||||||||||||||||||||||
| 1503 | |||||||||||||||||||||||||||||
| 1504 | =item gt example 3 | ||||||||||||||||||||||||||||
| 1505 | |||||||||||||||||||||||||||||
| 1506 | package main; | ||||||||||||||||||||||||||||
| 1507 | |||||||||||||||||||||||||||||
| 1508 | use Venus::Float; | ||||||||||||||||||||||||||||
| 1509 | use Venus::String; | ||||||||||||||||||||||||||||
| 1510 | |||||||||||||||||||||||||||||
| 1511 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1512 | my $rvalue = Venus::Float->new; | ||||||||||||||||||||||||||||
| 1513 | |||||||||||||||||||||||||||||
| 1514 | my $result = $lvalue->gt($rvalue); | ||||||||||||||||||||||||||||
| 1515 | |||||||||||||||||||||||||||||
| 1516 | # 0 | ||||||||||||||||||||||||||||
| 1517 | |||||||||||||||||||||||||||||
| 1518 | =back | ||||||||||||||||||||||||||||
| 1519 | |||||||||||||||||||||||||||||
| 1520 | =over 4 | ||||||||||||||||||||||||||||
| 1521 | |||||||||||||||||||||||||||||
| 1522 | =item gt example 4 | ||||||||||||||||||||||||||||
| 1523 | |||||||||||||||||||||||||||||
| 1524 | package main; | ||||||||||||||||||||||||||||
| 1525 | |||||||||||||||||||||||||||||
| 1526 | use Venus::Hash; | ||||||||||||||||||||||||||||
| 1527 | use Venus::String; | ||||||||||||||||||||||||||||
| 1528 | |||||||||||||||||||||||||||||
| 1529 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1530 | my $rvalue = Venus::Hash->new; | ||||||||||||||||||||||||||||
| 1531 | |||||||||||||||||||||||||||||
| 1532 | my $result = $lvalue->gt($rvalue); | ||||||||||||||||||||||||||||
| 1533 | |||||||||||||||||||||||||||||
| 1534 | # 0 | ||||||||||||||||||||||||||||
| 1535 | |||||||||||||||||||||||||||||
| 1536 | =back | ||||||||||||||||||||||||||||
| 1537 | |||||||||||||||||||||||||||||
| 1538 | =over 4 | ||||||||||||||||||||||||||||
| 1539 | |||||||||||||||||||||||||||||
| 1540 | =item gt example 5 | ||||||||||||||||||||||||||||
| 1541 | |||||||||||||||||||||||||||||
| 1542 | package main; | ||||||||||||||||||||||||||||
| 1543 | |||||||||||||||||||||||||||||
| 1544 | use Venus::Number; | ||||||||||||||||||||||||||||
| 1545 | use Venus::String; | ||||||||||||||||||||||||||||
| 1546 | |||||||||||||||||||||||||||||
| 1547 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1548 | my $rvalue = Venus::Number->new; | ||||||||||||||||||||||||||||
| 1549 | |||||||||||||||||||||||||||||
| 1550 | my $result = $lvalue->gt($rvalue); | ||||||||||||||||||||||||||||
| 1551 | |||||||||||||||||||||||||||||
| 1552 | # 0 | ||||||||||||||||||||||||||||
| 1553 | |||||||||||||||||||||||||||||
| 1554 | =back | ||||||||||||||||||||||||||||
| 1555 | |||||||||||||||||||||||||||||
| 1556 | =over 4 | ||||||||||||||||||||||||||||
| 1557 | |||||||||||||||||||||||||||||
| 1558 | =item gt example 6 | ||||||||||||||||||||||||||||
| 1559 | |||||||||||||||||||||||||||||
| 1560 | package main; | ||||||||||||||||||||||||||||
| 1561 | |||||||||||||||||||||||||||||
| 1562 | use Venus::Regexp; | ||||||||||||||||||||||||||||
| 1563 | use Venus::String; | ||||||||||||||||||||||||||||
| 1564 | |||||||||||||||||||||||||||||
| 1565 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1566 | my $rvalue = Venus::Regexp->new; | ||||||||||||||||||||||||||||
| 1567 | |||||||||||||||||||||||||||||
| 1568 | my $result = $lvalue->gt($rvalue); | ||||||||||||||||||||||||||||
| 1569 | |||||||||||||||||||||||||||||
| 1570 | # 0 | ||||||||||||||||||||||||||||
| 1571 | |||||||||||||||||||||||||||||
| 1572 | =back | ||||||||||||||||||||||||||||
| 1573 | |||||||||||||||||||||||||||||
| 1574 | =over 4 | ||||||||||||||||||||||||||||
| 1575 | |||||||||||||||||||||||||||||
| 1576 | =item gt example 7 | ||||||||||||||||||||||||||||
| 1577 | |||||||||||||||||||||||||||||
| 1578 | package main; | ||||||||||||||||||||||||||||
| 1579 | |||||||||||||||||||||||||||||
| 1580 | use Venus::Scalar; | ||||||||||||||||||||||||||||
| 1581 | use Venus::String; | ||||||||||||||||||||||||||||
| 1582 | |||||||||||||||||||||||||||||
| 1583 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1584 | my $rvalue = Venus::Scalar->new; | ||||||||||||||||||||||||||||
| 1585 | |||||||||||||||||||||||||||||
| 1586 | my $result = $lvalue->gt($rvalue); | ||||||||||||||||||||||||||||
| 1587 | |||||||||||||||||||||||||||||
| 1588 | # 0 | ||||||||||||||||||||||||||||
| 1589 | |||||||||||||||||||||||||||||
| 1590 | =back | ||||||||||||||||||||||||||||
| 1591 | |||||||||||||||||||||||||||||
| 1592 | =over 4 | ||||||||||||||||||||||||||||
| 1593 | |||||||||||||||||||||||||||||
| 1594 | =item gt example 8 | ||||||||||||||||||||||||||||
| 1595 | |||||||||||||||||||||||||||||
| 1596 | package main; | ||||||||||||||||||||||||||||
| 1597 | |||||||||||||||||||||||||||||
| 1598 | use Venus::String; | ||||||||||||||||||||||||||||
| 1599 | |||||||||||||||||||||||||||||
| 1600 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1601 | my $rvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1602 | |||||||||||||||||||||||||||||
| 1603 | my $result = $lvalue->gt($rvalue); | ||||||||||||||||||||||||||||
| 1604 | |||||||||||||||||||||||||||||
| 1605 | # 0 | ||||||||||||||||||||||||||||
| 1606 | |||||||||||||||||||||||||||||
| 1607 | =back | ||||||||||||||||||||||||||||
| 1608 | |||||||||||||||||||||||||||||
| 1609 | =over 4 | ||||||||||||||||||||||||||||
| 1610 | |||||||||||||||||||||||||||||
| 1611 | =item gt example 9 | ||||||||||||||||||||||||||||
| 1612 | |||||||||||||||||||||||||||||
| 1613 | package main; | ||||||||||||||||||||||||||||
| 1614 | |||||||||||||||||||||||||||||
| 1615 | use Venus::String; | ||||||||||||||||||||||||||||
| 1616 | use Venus::Undef; | ||||||||||||||||||||||||||||
| 1617 | |||||||||||||||||||||||||||||
| 1618 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1619 | my $rvalue = Venus::Undef->new; | ||||||||||||||||||||||||||||
| 1620 | |||||||||||||||||||||||||||||
| 1621 | my $result = $lvalue->gt($rvalue); | ||||||||||||||||||||||||||||
| 1622 | |||||||||||||||||||||||||||||
| 1623 | # 0 | ||||||||||||||||||||||||||||
| 1624 | |||||||||||||||||||||||||||||
| 1625 | =back | ||||||||||||||||||||||||||||
| 1626 | |||||||||||||||||||||||||||||
| 1627 | =cut | ||||||||||||||||||||||||||||
| 1628 | |||||||||||||||||||||||||||||
| 1629 | =head2 gtlt | ||||||||||||||||||||||||||||
| 1630 | |||||||||||||||||||||||||||||
| 1631 | gtlt(any $arg1, any $arg2) (boolean) | ||||||||||||||||||||||||||||
| 1632 | |||||||||||||||||||||||||||||
| 1633 | The gtlt method performs a I<"greater-than"> operation on the 1st argument, and | ||||||||||||||||||||||||||||
| 1634 | I<"lesser-than"> operation on the 2nd argument. | ||||||||||||||||||||||||||||
| 1635 | |||||||||||||||||||||||||||||
| 1636 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 1637 | |||||||||||||||||||||||||||||
| 1638 | =over 4 | ||||||||||||||||||||||||||||
| 1639 | |||||||||||||||||||||||||||||
| 1640 | =item gtlt example 1 | ||||||||||||||||||||||||||||
| 1641 | |||||||||||||||||||||||||||||
| 1642 | package main; | ||||||||||||||||||||||||||||
| 1643 | |||||||||||||||||||||||||||||
| 1644 | use Venus::Array; | ||||||||||||||||||||||||||||
| 1645 | use Venus::String; | ||||||||||||||||||||||||||||
| 1646 | |||||||||||||||||||||||||||||
| 1647 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1648 | my $rvalue = Venus::Array->new; | ||||||||||||||||||||||||||||
| 1649 | |||||||||||||||||||||||||||||
| 1650 | my $result = $lvalue->gtlt($rvalue); | ||||||||||||||||||||||||||||
| 1651 | |||||||||||||||||||||||||||||
| 1652 | # 0 | ||||||||||||||||||||||||||||
| 1653 | |||||||||||||||||||||||||||||
| 1654 | =back | ||||||||||||||||||||||||||||
| 1655 | |||||||||||||||||||||||||||||
| 1656 | =over 4 | ||||||||||||||||||||||||||||
| 1657 | |||||||||||||||||||||||||||||
| 1658 | =item gtlt example 2 | ||||||||||||||||||||||||||||
| 1659 | |||||||||||||||||||||||||||||
| 1660 | package main; | ||||||||||||||||||||||||||||
| 1661 | |||||||||||||||||||||||||||||
| 1662 | use Venus::Code; | ||||||||||||||||||||||||||||
| 1663 | use Venus::String; | ||||||||||||||||||||||||||||
| 1664 | |||||||||||||||||||||||||||||
| 1665 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1666 | my $rvalue = Venus::Code->new; | ||||||||||||||||||||||||||||
| 1667 | |||||||||||||||||||||||||||||
| 1668 | my $result = $lvalue->gtlt($rvalue); | ||||||||||||||||||||||||||||
| 1669 | |||||||||||||||||||||||||||||
| 1670 | # 0 | ||||||||||||||||||||||||||||
| 1671 | |||||||||||||||||||||||||||||
| 1672 | =back | ||||||||||||||||||||||||||||
| 1673 | |||||||||||||||||||||||||||||
| 1674 | =over 4 | ||||||||||||||||||||||||||||
| 1675 | |||||||||||||||||||||||||||||
| 1676 | =item gtlt example 3 | ||||||||||||||||||||||||||||
| 1677 | |||||||||||||||||||||||||||||
| 1678 | package main; | ||||||||||||||||||||||||||||
| 1679 | |||||||||||||||||||||||||||||
| 1680 | use Venus::Float; | ||||||||||||||||||||||||||||
| 1681 | use Venus::String; | ||||||||||||||||||||||||||||
| 1682 | |||||||||||||||||||||||||||||
| 1683 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1684 | my $rvalue = Venus::Float->new; | ||||||||||||||||||||||||||||
| 1685 | |||||||||||||||||||||||||||||
| 1686 | my $result = $lvalue->gtlt($rvalue); | ||||||||||||||||||||||||||||
| 1687 | |||||||||||||||||||||||||||||
| 1688 | # 0 | ||||||||||||||||||||||||||||
| 1689 | |||||||||||||||||||||||||||||
| 1690 | =back | ||||||||||||||||||||||||||||
| 1691 | |||||||||||||||||||||||||||||
| 1692 | =over 4 | ||||||||||||||||||||||||||||
| 1693 | |||||||||||||||||||||||||||||
| 1694 | =item gtlt example 4 | ||||||||||||||||||||||||||||
| 1695 | |||||||||||||||||||||||||||||
| 1696 | package main; | ||||||||||||||||||||||||||||
| 1697 | |||||||||||||||||||||||||||||
| 1698 | use Venus::Hash; | ||||||||||||||||||||||||||||
| 1699 | use Venus::String; | ||||||||||||||||||||||||||||
| 1700 | |||||||||||||||||||||||||||||
| 1701 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1702 | my $rvalue = Venus::Hash->new; | ||||||||||||||||||||||||||||
| 1703 | |||||||||||||||||||||||||||||
| 1704 | my $result = $lvalue->gtlt($rvalue); | ||||||||||||||||||||||||||||
| 1705 | |||||||||||||||||||||||||||||
| 1706 | # 0 | ||||||||||||||||||||||||||||
| 1707 | |||||||||||||||||||||||||||||
| 1708 | =back | ||||||||||||||||||||||||||||
| 1709 | |||||||||||||||||||||||||||||
| 1710 | =over 4 | ||||||||||||||||||||||||||||
| 1711 | |||||||||||||||||||||||||||||
| 1712 | =item gtlt example 5 | ||||||||||||||||||||||||||||
| 1713 | |||||||||||||||||||||||||||||
| 1714 | package main; | ||||||||||||||||||||||||||||
| 1715 | |||||||||||||||||||||||||||||
| 1716 | use Venus::Number; | ||||||||||||||||||||||||||||
| 1717 | use Venus::String; | ||||||||||||||||||||||||||||
| 1718 | |||||||||||||||||||||||||||||
| 1719 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1720 | my $rvalue = Venus::Number->new; | ||||||||||||||||||||||||||||
| 1721 | |||||||||||||||||||||||||||||
| 1722 | my $result = $lvalue->gtlt($rvalue); | ||||||||||||||||||||||||||||
| 1723 | |||||||||||||||||||||||||||||
| 1724 | # 0 | ||||||||||||||||||||||||||||
| 1725 | |||||||||||||||||||||||||||||
| 1726 | =back | ||||||||||||||||||||||||||||
| 1727 | |||||||||||||||||||||||||||||
| 1728 | =over 4 | ||||||||||||||||||||||||||||
| 1729 | |||||||||||||||||||||||||||||
| 1730 | =item gtlt example 6 | ||||||||||||||||||||||||||||
| 1731 | |||||||||||||||||||||||||||||
| 1732 | package main; | ||||||||||||||||||||||||||||
| 1733 | |||||||||||||||||||||||||||||
| 1734 | use Venus::Regexp; | ||||||||||||||||||||||||||||
| 1735 | use Venus::String; | ||||||||||||||||||||||||||||
| 1736 | |||||||||||||||||||||||||||||
| 1737 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1738 | my $rvalue = Venus::Regexp->new; | ||||||||||||||||||||||||||||
| 1739 | |||||||||||||||||||||||||||||
| 1740 | my $result = $lvalue->gtlt($rvalue); | ||||||||||||||||||||||||||||
| 1741 | |||||||||||||||||||||||||||||
| 1742 | # 0 | ||||||||||||||||||||||||||||
| 1743 | |||||||||||||||||||||||||||||
| 1744 | =back | ||||||||||||||||||||||||||||
| 1745 | |||||||||||||||||||||||||||||
| 1746 | =over 4 | ||||||||||||||||||||||||||||
| 1747 | |||||||||||||||||||||||||||||
| 1748 | =item gtlt example 7 | ||||||||||||||||||||||||||||
| 1749 | |||||||||||||||||||||||||||||
| 1750 | package main; | ||||||||||||||||||||||||||||
| 1751 | |||||||||||||||||||||||||||||
| 1752 | use Venus::Scalar; | ||||||||||||||||||||||||||||
| 1753 | use Venus::String; | ||||||||||||||||||||||||||||
| 1754 | |||||||||||||||||||||||||||||
| 1755 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1756 | my $rvalue = Venus::Scalar->new; | ||||||||||||||||||||||||||||
| 1757 | |||||||||||||||||||||||||||||
| 1758 | my $result = $lvalue->gtlt($rvalue); | ||||||||||||||||||||||||||||
| 1759 | |||||||||||||||||||||||||||||
| 1760 | # 0 | ||||||||||||||||||||||||||||
| 1761 | |||||||||||||||||||||||||||||
| 1762 | =back | ||||||||||||||||||||||||||||
| 1763 | |||||||||||||||||||||||||||||
| 1764 | =over 4 | ||||||||||||||||||||||||||||
| 1765 | |||||||||||||||||||||||||||||
| 1766 | =item gtlt example 8 | ||||||||||||||||||||||||||||
| 1767 | |||||||||||||||||||||||||||||
| 1768 | package main; | ||||||||||||||||||||||||||||
| 1769 | |||||||||||||||||||||||||||||
| 1770 | use Venus::String; | ||||||||||||||||||||||||||||
| 1771 | |||||||||||||||||||||||||||||
| 1772 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1773 | my $rvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1774 | |||||||||||||||||||||||||||||
| 1775 | my $result = $lvalue->gtlt($rvalue); | ||||||||||||||||||||||||||||
| 1776 | |||||||||||||||||||||||||||||
| 1777 | # 0 | ||||||||||||||||||||||||||||
| 1778 | |||||||||||||||||||||||||||||
| 1779 | =back | ||||||||||||||||||||||||||||
| 1780 | |||||||||||||||||||||||||||||
| 1781 | =over 4 | ||||||||||||||||||||||||||||
| 1782 | |||||||||||||||||||||||||||||
| 1783 | =item gtlt example 9 | ||||||||||||||||||||||||||||
| 1784 | |||||||||||||||||||||||||||||
| 1785 | package main; | ||||||||||||||||||||||||||||
| 1786 | |||||||||||||||||||||||||||||
| 1787 | use Venus::String; | ||||||||||||||||||||||||||||
| 1788 | use Venus::Undef; | ||||||||||||||||||||||||||||
| 1789 | |||||||||||||||||||||||||||||
| 1790 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1791 | my $rvalue = Venus::Undef->new; | ||||||||||||||||||||||||||||
| 1792 | |||||||||||||||||||||||||||||
| 1793 | my $result = $lvalue->gtlt($rvalue); | ||||||||||||||||||||||||||||
| 1794 | |||||||||||||||||||||||||||||
| 1795 | # 0 | ||||||||||||||||||||||||||||
| 1796 | |||||||||||||||||||||||||||||
| 1797 | =back | ||||||||||||||||||||||||||||
| 1798 | |||||||||||||||||||||||||||||
| 1799 | =cut | ||||||||||||||||||||||||||||
| 1800 | |||||||||||||||||||||||||||||
| 1801 | =head2 hex | ||||||||||||||||||||||||||||
| 1802 | |||||||||||||||||||||||||||||
| 1803 | hex() (string) | ||||||||||||||||||||||||||||
| 1804 | |||||||||||||||||||||||||||||
| 1805 | The hex method returns the value resulting from interpreting the string as a | ||||||||||||||||||||||||||||
| 1806 | hex string. | ||||||||||||||||||||||||||||
| 1807 | |||||||||||||||||||||||||||||
| 1808 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 1809 | |||||||||||||||||||||||||||||
| 1810 | =over 4 | ||||||||||||||||||||||||||||
| 1811 | |||||||||||||||||||||||||||||
| 1812 | =item hex example 1 | ||||||||||||||||||||||||||||
| 1813 | |||||||||||||||||||||||||||||
| 1814 | package main; | ||||||||||||||||||||||||||||
| 1815 | |||||||||||||||||||||||||||||
| 1816 | use Venus::String; | ||||||||||||||||||||||||||||
| 1817 | |||||||||||||||||||||||||||||
| 1818 | my $string = Venus::String->new('0xaf'); | ||||||||||||||||||||||||||||
| 1819 | |||||||||||||||||||||||||||||
| 1820 | my $hex = $string->hex; | ||||||||||||||||||||||||||||
| 1821 | |||||||||||||||||||||||||||||
| 1822 | # 175 | ||||||||||||||||||||||||||||
| 1823 | |||||||||||||||||||||||||||||
| 1824 | =back | ||||||||||||||||||||||||||||
| 1825 | |||||||||||||||||||||||||||||
| 1826 | =cut | ||||||||||||||||||||||||||||
| 1827 | |||||||||||||||||||||||||||||
| 1828 | =head2 index | ||||||||||||||||||||||||||||
| 1829 | |||||||||||||||||||||||||||||
| 1830 | index(string $substr, number $start) (number) | ||||||||||||||||||||||||||||
| 1831 | |||||||||||||||||||||||||||||
| 1832 | The index method searches for the argument within the string and returns the | ||||||||||||||||||||||||||||
| 1833 | position of the first occurrence of the argument. | ||||||||||||||||||||||||||||
| 1834 | |||||||||||||||||||||||||||||
| 1835 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 1836 | |||||||||||||||||||||||||||||
| 1837 | =over 4 | ||||||||||||||||||||||||||||
| 1838 | |||||||||||||||||||||||||||||
| 1839 | =item index example 1 | ||||||||||||||||||||||||||||
| 1840 | |||||||||||||||||||||||||||||
| 1841 | package main; | ||||||||||||||||||||||||||||
| 1842 | |||||||||||||||||||||||||||||
| 1843 | use Venus::String; | ||||||||||||||||||||||||||||
| 1844 | |||||||||||||||||||||||||||||
| 1845 | my $string = Venus::String->new('unexplainable'); | ||||||||||||||||||||||||||||
| 1846 | |||||||||||||||||||||||||||||
| 1847 | my $index = $string->index('explain'); | ||||||||||||||||||||||||||||
| 1848 | |||||||||||||||||||||||||||||
| 1849 | # 2 | ||||||||||||||||||||||||||||
| 1850 | |||||||||||||||||||||||||||||
| 1851 | =back | ||||||||||||||||||||||||||||
| 1852 | |||||||||||||||||||||||||||||
| 1853 | =over 4 | ||||||||||||||||||||||||||||
| 1854 | |||||||||||||||||||||||||||||
| 1855 | =item index example 2 | ||||||||||||||||||||||||||||
| 1856 | |||||||||||||||||||||||||||||
| 1857 | package main; | ||||||||||||||||||||||||||||
| 1858 | |||||||||||||||||||||||||||||
| 1859 | use Venus::String; | ||||||||||||||||||||||||||||
| 1860 | |||||||||||||||||||||||||||||
| 1861 | my $string = Venus::String->new('unexplainable'); | ||||||||||||||||||||||||||||
| 1862 | |||||||||||||||||||||||||||||
| 1863 | my $index = $string->index('explain', 1); | ||||||||||||||||||||||||||||
| 1864 | |||||||||||||||||||||||||||||
| 1865 | # 2 | ||||||||||||||||||||||||||||
| 1866 | |||||||||||||||||||||||||||||
| 1867 | =back | ||||||||||||||||||||||||||||
| 1868 | |||||||||||||||||||||||||||||
| 1869 | =over 4 | ||||||||||||||||||||||||||||
| 1870 | |||||||||||||||||||||||||||||
| 1871 | =item index example 3 | ||||||||||||||||||||||||||||
| 1872 | |||||||||||||||||||||||||||||
| 1873 | package main; | ||||||||||||||||||||||||||||
| 1874 | |||||||||||||||||||||||||||||
| 1875 | use Venus::String; | ||||||||||||||||||||||||||||
| 1876 | |||||||||||||||||||||||||||||
| 1877 | my $string = Venus::String->new('unexplainable'); | ||||||||||||||||||||||||||||
| 1878 | |||||||||||||||||||||||||||||
| 1879 | my $index = $string->index('explained'); | ||||||||||||||||||||||||||||
| 1880 | |||||||||||||||||||||||||||||
| 1881 | # -1 | ||||||||||||||||||||||||||||
| 1882 | |||||||||||||||||||||||||||||
| 1883 | =back | ||||||||||||||||||||||||||||
| 1884 | |||||||||||||||||||||||||||||
| 1885 | =cut | ||||||||||||||||||||||||||||
| 1886 | |||||||||||||||||||||||||||||
| 1887 | =head2 kebabcase | ||||||||||||||||||||||||||||
| 1888 | |||||||||||||||||||||||||||||
| 1889 | kebabcase() (string) | ||||||||||||||||||||||||||||
| 1890 | |||||||||||||||||||||||||||||
| 1891 | The kebabcase method converts the string to kebabcase. | ||||||||||||||||||||||||||||
| 1892 | |||||||||||||||||||||||||||||
| 1893 | I<Since C<0.09>> | ||||||||||||||||||||||||||||
| 1894 | |||||||||||||||||||||||||||||
| 1895 | =over 4 | ||||||||||||||||||||||||||||
| 1896 | |||||||||||||||||||||||||||||
| 1897 | =item kebabcase example 1 | ||||||||||||||||||||||||||||
| 1898 | |||||||||||||||||||||||||||||
| 1899 | # given: synopsis; | ||||||||||||||||||||||||||||
| 1900 | |||||||||||||||||||||||||||||
| 1901 | my $kebabcase = $string->kebabcase; | ||||||||||||||||||||||||||||
| 1902 | |||||||||||||||||||||||||||||
| 1903 | # "hello-world" | ||||||||||||||||||||||||||||
| 1904 | |||||||||||||||||||||||||||||
| 1905 | =back | ||||||||||||||||||||||||||||
| 1906 | |||||||||||||||||||||||||||||
| 1907 | =cut | ||||||||||||||||||||||||||||
| 1908 | |||||||||||||||||||||||||||||
| 1909 | =head2 lc | ||||||||||||||||||||||||||||
| 1910 | |||||||||||||||||||||||||||||
| 1911 | lc() (string) | ||||||||||||||||||||||||||||
| 1912 | |||||||||||||||||||||||||||||
| 1913 | The lc method returns a lowercased version of the string. | ||||||||||||||||||||||||||||
| 1914 | |||||||||||||||||||||||||||||
| 1915 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 1916 | |||||||||||||||||||||||||||||
| 1917 | =over 4 | ||||||||||||||||||||||||||||
| 1918 | |||||||||||||||||||||||||||||
| 1919 | =item lc example 1 | ||||||||||||||||||||||||||||
| 1920 | |||||||||||||||||||||||||||||
| 1921 | package main; | ||||||||||||||||||||||||||||
| 1922 | |||||||||||||||||||||||||||||
| 1923 | use Venus::String; | ||||||||||||||||||||||||||||
| 1924 | |||||||||||||||||||||||||||||
| 1925 | my $string = Venus::String->new('Hello World'); | ||||||||||||||||||||||||||||
| 1926 | |||||||||||||||||||||||||||||
| 1927 | my $lc = $string->lc; | ||||||||||||||||||||||||||||
| 1928 | |||||||||||||||||||||||||||||
| 1929 | # "hello world" | ||||||||||||||||||||||||||||
| 1930 | |||||||||||||||||||||||||||||
| 1931 | =back | ||||||||||||||||||||||||||||
| 1932 | |||||||||||||||||||||||||||||
| 1933 | =cut | ||||||||||||||||||||||||||||
| 1934 | |||||||||||||||||||||||||||||
| 1935 | =head2 lcfirst | ||||||||||||||||||||||||||||
| 1936 | |||||||||||||||||||||||||||||
| 1937 | lcfirst() (string) | ||||||||||||||||||||||||||||
| 1938 | |||||||||||||||||||||||||||||
| 1939 | The lcfirst method returns a the string with the first character lowercased. | ||||||||||||||||||||||||||||
| 1940 | |||||||||||||||||||||||||||||
| 1941 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 1942 | |||||||||||||||||||||||||||||
| 1943 | =over 4 | ||||||||||||||||||||||||||||
| 1944 | |||||||||||||||||||||||||||||
| 1945 | =item lcfirst example 1 | ||||||||||||||||||||||||||||
| 1946 | |||||||||||||||||||||||||||||
| 1947 | package main; | ||||||||||||||||||||||||||||
| 1948 | |||||||||||||||||||||||||||||
| 1949 | use Venus::String; | ||||||||||||||||||||||||||||
| 1950 | |||||||||||||||||||||||||||||
| 1951 | my $string = Venus::String->new('Hello World'); | ||||||||||||||||||||||||||||
| 1952 | |||||||||||||||||||||||||||||
| 1953 | my $lcfirst = $string->lcfirst; | ||||||||||||||||||||||||||||
| 1954 | |||||||||||||||||||||||||||||
| 1955 | # "hello World" | ||||||||||||||||||||||||||||
| 1956 | |||||||||||||||||||||||||||||
| 1957 | =back | ||||||||||||||||||||||||||||
| 1958 | |||||||||||||||||||||||||||||
| 1959 | =cut | ||||||||||||||||||||||||||||
| 1960 | |||||||||||||||||||||||||||||
| 1961 | =head2 le | ||||||||||||||||||||||||||||
| 1962 | |||||||||||||||||||||||||||||
| 1963 | le(any $arg) (boolean) | ||||||||||||||||||||||||||||
| 1964 | |||||||||||||||||||||||||||||
| 1965 | The le method performs a I<"lesser-than-or-equal-to"> operation using the | ||||||||||||||||||||||||||||
| 1966 | argument provided. | ||||||||||||||||||||||||||||
| 1967 | |||||||||||||||||||||||||||||
| 1968 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 1969 | |||||||||||||||||||||||||||||
| 1970 | =over 4 | ||||||||||||||||||||||||||||
| 1971 | |||||||||||||||||||||||||||||
| 1972 | =item le example 1 | ||||||||||||||||||||||||||||
| 1973 | |||||||||||||||||||||||||||||
| 1974 | package main; | ||||||||||||||||||||||||||||
| 1975 | |||||||||||||||||||||||||||||
| 1976 | use Venus::Array; | ||||||||||||||||||||||||||||
| 1977 | use Venus::String; | ||||||||||||||||||||||||||||
| 1978 | |||||||||||||||||||||||||||||
| 1979 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1980 | my $rvalue = Venus::Array->new; | ||||||||||||||||||||||||||||
| 1981 | |||||||||||||||||||||||||||||
| 1982 | my $result = $lvalue->le($rvalue); | ||||||||||||||||||||||||||||
| 1983 | |||||||||||||||||||||||||||||
| 1984 | # 1 | ||||||||||||||||||||||||||||
| 1985 | |||||||||||||||||||||||||||||
| 1986 | =back | ||||||||||||||||||||||||||||
| 1987 | |||||||||||||||||||||||||||||
| 1988 | =over 4 | ||||||||||||||||||||||||||||
| 1989 | |||||||||||||||||||||||||||||
| 1990 | =item le example 2 | ||||||||||||||||||||||||||||
| 1991 | |||||||||||||||||||||||||||||
| 1992 | package main; | ||||||||||||||||||||||||||||
| 1993 | |||||||||||||||||||||||||||||
| 1994 | use Venus::Code; | ||||||||||||||||||||||||||||
| 1995 | use Venus::String; | ||||||||||||||||||||||||||||
| 1996 | |||||||||||||||||||||||||||||
| 1997 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1998 | my $rvalue = Venus::Code->new; | ||||||||||||||||||||||||||||
| 1999 | |||||||||||||||||||||||||||||
| 2000 | my $result = $lvalue->le($rvalue); | ||||||||||||||||||||||||||||
| 2001 | |||||||||||||||||||||||||||||
| 2002 | # 1 | ||||||||||||||||||||||||||||
| 2003 | |||||||||||||||||||||||||||||
| 2004 | =back | ||||||||||||||||||||||||||||
| 2005 | |||||||||||||||||||||||||||||
| 2006 | =over 4 | ||||||||||||||||||||||||||||
| 2007 | |||||||||||||||||||||||||||||
| 2008 | =item le example 3 | ||||||||||||||||||||||||||||
| 2009 | |||||||||||||||||||||||||||||
| 2010 | package main; | ||||||||||||||||||||||||||||
| 2011 | |||||||||||||||||||||||||||||
| 2012 | use Venus::Float; | ||||||||||||||||||||||||||||
| 2013 | use Venus::String; | ||||||||||||||||||||||||||||
| 2014 | |||||||||||||||||||||||||||||
| 2015 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2016 | my $rvalue = Venus::Float->new; | ||||||||||||||||||||||||||||
| 2017 | |||||||||||||||||||||||||||||
| 2018 | my $result = $lvalue->le($rvalue); | ||||||||||||||||||||||||||||
| 2019 | |||||||||||||||||||||||||||||
| 2020 | # 1 | ||||||||||||||||||||||||||||
| 2021 | |||||||||||||||||||||||||||||
| 2022 | =back | ||||||||||||||||||||||||||||
| 2023 | |||||||||||||||||||||||||||||
| 2024 | =over 4 | ||||||||||||||||||||||||||||
| 2025 | |||||||||||||||||||||||||||||
| 2026 | =item le example 4 | ||||||||||||||||||||||||||||
| 2027 | |||||||||||||||||||||||||||||
| 2028 | package main; | ||||||||||||||||||||||||||||
| 2029 | |||||||||||||||||||||||||||||
| 2030 | use Venus::Hash; | ||||||||||||||||||||||||||||
| 2031 | use Venus::String; | ||||||||||||||||||||||||||||
| 2032 | |||||||||||||||||||||||||||||
| 2033 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2034 | my $rvalue = Venus::Hash->new; | ||||||||||||||||||||||||||||
| 2035 | |||||||||||||||||||||||||||||
| 2036 | my $result = $lvalue->le($rvalue); | ||||||||||||||||||||||||||||
| 2037 | |||||||||||||||||||||||||||||
| 2038 | # 1 | ||||||||||||||||||||||||||||
| 2039 | |||||||||||||||||||||||||||||
| 2040 | =back | ||||||||||||||||||||||||||||
| 2041 | |||||||||||||||||||||||||||||
| 2042 | =over 4 | ||||||||||||||||||||||||||||
| 2043 | |||||||||||||||||||||||||||||
| 2044 | =item le example 5 | ||||||||||||||||||||||||||||
| 2045 | |||||||||||||||||||||||||||||
| 2046 | package main; | ||||||||||||||||||||||||||||
| 2047 | |||||||||||||||||||||||||||||
| 2048 | use Venus::Number; | ||||||||||||||||||||||||||||
| 2049 | use Venus::String; | ||||||||||||||||||||||||||||
| 2050 | |||||||||||||||||||||||||||||
| 2051 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2052 | my $rvalue = Venus::Number->new; | ||||||||||||||||||||||||||||
| 2053 | |||||||||||||||||||||||||||||
| 2054 | my $result = $lvalue->le($rvalue); | ||||||||||||||||||||||||||||
| 2055 | |||||||||||||||||||||||||||||
| 2056 | # 1 | ||||||||||||||||||||||||||||
| 2057 | |||||||||||||||||||||||||||||
| 2058 | =back | ||||||||||||||||||||||||||||
| 2059 | |||||||||||||||||||||||||||||
| 2060 | =over 4 | ||||||||||||||||||||||||||||
| 2061 | |||||||||||||||||||||||||||||
| 2062 | =item le example 6 | ||||||||||||||||||||||||||||
| 2063 | |||||||||||||||||||||||||||||
| 2064 | package main; | ||||||||||||||||||||||||||||
| 2065 | |||||||||||||||||||||||||||||
| 2066 | use Venus::Regexp; | ||||||||||||||||||||||||||||
| 2067 | use Venus::String; | ||||||||||||||||||||||||||||
| 2068 | |||||||||||||||||||||||||||||
| 2069 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2070 | my $rvalue = Venus::Regexp->new; | ||||||||||||||||||||||||||||
| 2071 | |||||||||||||||||||||||||||||
| 2072 | my $result = $lvalue->le($rvalue); | ||||||||||||||||||||||||||||
| 2073 | |||||||||||||||||||||||||||||
| 2074 | # 1 | ||||||||||||||||||||||||||||
| 2075 | |||||||||||||||||||||||||||||
| 2076 | =back | ||||||||||||||||||||||||||||
| 2077 | |||||||||||||||||||||||||||||
| 2078 | =over 4 | ||||||||||||||||||||||||||||
| 2079 | |||||||||||||||||||||||||||||
| 2080 | =item le example 7 | ||||||||||||||||||||||||||||
| 2081 | |||||||||||||||||||||||||||||
| 2082 | package main; | ||||||||||||||||||||||||||||
| 2083 | |||||||||||||||||||||||||||||
| 2084 | use Venus::Scalar; | ||||||||||||||||||||||||||||
| 2085 | use Venus::String; | ||||||||||||||||||||||||||||
| 2086 | |||||||||||||||||||||||||||||
| 2087 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2088 | my $rvalue = Venus::Scalar->new; | ||||||||||||||||||||||||||||
| 2089 | |||||||||||||||||||||||||||||
| 2090 | my $result = $lvalue->le($rvalue); | ||||||||||||||||||||||||||||
| 2091 | |||||||||||||||||||||||||||||
| 2092 | # 1 | ||||||||||||||||||||||||||||
| 2093 | |||||||||||||||||||||||||||||
| 2094 | =back | ||||||||||||||||||||||||||||
| 2095 | |||||||||||||||||||||||||||||
| 2096 | =over 4 | ||||||||||||||||||||||||||||
| 2097 | |||||||||||||||||||||||||||||
| 2098 | =item le example 8 | ||||||||||||||||||||||||||||
| 2099 | |||||||||||||||||||||||||||||
| 2100 | package main; | ||||||||||||||||||||||||||||
| 2101 | |||||||||||||||||||||||||||||
| 2102 | use Venus::String; | ||||||||||||||||||||||||||||
| 2103 | |||||||||||||||||||||||||||||
| 2104 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2105 | my $rvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2106 | |||||||||||||||||||||||||||||
| 2107 | my $result = $lvalue->le($rvalue); | ||||||||||||||||||||||||||||
| 2108 | |||||||||||||||||||||||||||||
| 2109 | # 1 | ||||||||||||||||||||||||||||
| 2110 | |||||||||||||||||||||||||||||
| 2111 | =back | ||||||||||||||||||||||||||||
| 2112 | |||||||||||||||||||||||||||||
| 2113 | =over 4 | ||||||||||||||||||||||||||||
| 2114 | |||||||||||||||||||||||||||||
| 2115 | =item le example 9 | ||||||||||||||||||||||||||||
| 2116 | |||||||||||||||||||||||||||||
| 2117 | package main; | ||||||||||||||||||||||||||||
| 2118 | |||||||||||||||||||||||||||||
| 2119 | use Venus::String; | ||||||||||||||||||||||||||||
| 2120 | use Venus::Undef; | ||||||||||||||||||||||||||||
| 2121 | |||||||||||||||||||||||||||||
| 2122 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2123 | my $rvalue = Venus::Undef->new; | ||||||||||||||||||||||||||||
| 2124 | |||||||||||||||||||||||||||||
| 2125 | my $result = $lvalue->le($rvalue); | ||||||||||||||||||||||||||||
| 2126 | |||||||||||||||||||||||||||||
| 2127 | # 1 | ||||||||||||||||||||||||||||
| 2128 | |||||||||||||||||||||||||||||
| 2129 | =back | ||||||||||||||||||||||||||||
| 2130 | |||||||||||||||||||||||||||||
| 2131 | =cut | ||||||||||||||||||||||||||||
| 2132 | |||||||||||||||||||||||||||||
| 2133 | =head2 length | ||||||||||||||||||||||||||||
| 2134 | |||||||||||||||||||||||||||||
| 2135 | length() (number) | ||||||||||||||||||||||||||||
| 2136 | |||||||||||||||||||||||||||||
| 2137 | The length method returns the number of characters within the string. | ||||||||||||||||||||||||||||
| 2138 | |||||||||||||||||||||||||||||
| 2139 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2140 | |||||||||||||||||||||||||||||
| 2141 | =over 4 | ||||||||||||||||||||||||||||
| 2142 | |||||||||||||||||||||||||||||
| 2143 | =item length example 1 | ||||||||||||||||||||||||||||
| 2144 | |||||||||||||||||||||||||||||
| 2145 | # given: synopsis; | ||||||||||||||||||||||||||||
| 2146 | |||||||||||||||||||||||||||||
| 2147 | my $length = $string->length; | ||||||||||||||||||||||||||||
| 2148 | |||||||||||||||||||||||||||||
| 2149 | # 11 | ||||||||||||||||||||||||||||
| 2150 | |||||||||||||||||||||||||||||
| 2151 | =back | ||||||||||||||||||||||||||||
| 2152 | |||||||||||||||||||||||||||||
| 2153 | =cut | ||||||||||||||||||||||||||||
| 2154 | |||||||||||||||||||||||||||||
| 2155 | =head2 lines | ||||||||||||||||||||||||||||
| 2156 | |||||||||||||||||||||||||||||
| 2157 | lines() (within[arrayref, string]) | ||||||||||||||||||||||||||||
| 2158 | |||||||||||||||||||||||||||||
| 2159 | The lines method returns an arrayref of parts by splitting on 1 or more newline | ||||||||||||||||||||||||||||
| 2160 | characters. | ||||||||||||||||||||||||||||
| 2161 | |||||||||||||||||||||||||||||
| 2162 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2163 | |||||||||||||||||||||||||||||
| 2164 | =over 4 | ||||||||||||||||||||||||||||
| 2165 | |||||||||||||||||||||||||||||
| 2166 | =item lines example 1 | ||||||||||||||||||||||||||||
| 2167 | |||||||||||||||||||||||||||||
| 2168 | # given: synopsis; | ||||||||||||||||||||||||||||
| 2169 | |||||||||||||||||||||||||||||
| 2170 | my $lines = $string->lines; | ||||||||||||||||||||||||||||
| 2171 | |||||||||||||||||||||||||||||
| 2172 | # ["hello world"] | ||||||||||||||||||||||||||||
| 2173 | |||||||||||||||||||||||||||||
| 2174 | =back | ||||||||||||||||||||||||||||
| 2175 | |||||||||||||||||||||||||||||
| 2176 | =over 4 | ||||||||||||||||||||||||||||
| 2177 | |||||||||||||||||||||||||||||
| 2178 | =item lines example 2 | ||||||||||||||||||||||||||||
| 2179 | |||||||||||||||||||||||||||||
| 2180 | package main; | ||||||||||||||||||||||||||||
| 2181 | |||||||||||||||||||||||||||||
| 2182 | use Venus::String; | ||||||||||||||||||||||||||||
| 2183 | |||||||||||||||||||||||||||||
| 2184 | my $string = Venus::String->new("who am i?\nwhere am i?\nhow did I get here"); | ||||||||||||||||||||||||||||
| 2185 | |||||||||||||||||||||||||||||
| 2186 | my $lines = $string->lines; | ||||||||||||||||||||||||||||
| 2187 | |||||||||||||||||||||||||||||
| 2188 | # ["who am i?", "where am i?", "how did I get here"] | ||||||||||||||||||||||||||||
| 2189 | |||||||||||||||||||||||||||||
| 2190 | =back | ||||||||||||||||||||||||||||
| 2191 | |||||||||||||||||||||||||||||
| 2192 | =cut | ||||||||||||||||||||||||||||
| 2193 | |||||||||||||||||||||||||||||
| 2194 | =head2 lowercase | ||||||||||||||||||||||||||||
| 2195 | |||||||||||||||||||||||||||||
| 2196 | lowercase() (string) | ||||||||||||||||||||||||||||
| 2197 | |||||||||||||||||||||||||||||
| 2198 | The lowercase method is an alias to the lc method. | ||||||||||||||||||||||||||||
| 2199 | |||||||||||||||||||||||||||||
| 2200 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2201 | |||||||||||||||||||||||||||||
| 2202 | =over 4 | ||||||||||||||||||||||||||||
| 2203 | |||||||||||||||||||||||||||||
| 2204 | =item lowercase example 1 | ||||||||||||||||||||||||||||
| 2205 | |||||||||||||||||||||||||||||
| 2206 | package main; | ||||||||||||||||||||||||||||
| 2207 | |||||||||||||||||||||||||||||
| 2208 | use Venus::String; | ||||||||||||||||||||||||||||
| 2209 | |||||||||||||||||||||||||||||
| 2210 | my $string = Venus::String->new('Hello World'); | ||||||||||||||||||||||||||||
| 2211 | |||||||||||||||||||||||||||||
| 2212 | my $lowercase = $string->lowercase; | ||||||||||||||||||||||||||||
| 2213 | |||||||||||||||||||||||||||||
| 2214 | # "hello world" | ||||||||||||||||||||||||||||
| 2215 | |||||||||||||||||||||||||||||
| 2216 | =back | ||||||||||||||||||||||||||||
| 2217 | |||||||||||||||||||||||||||||
| 2218 | =cut | ||||||||||||||||||||||||||||
| 2219 | |||||||||||||||||||||||||||||
| 2220 | =head2 lt | ||||||||||||||||||||||||||||
| 2221 | |||||||||||||||||||||||||||||
| 2222 | lt(any $arg) (boolean) | ||||||||||||||||||||||||||||
| 2223 | |||||||||||||||||||||||||||||
| 2224 | The lt method performs a I<"lesser-than"> operation using the argument provided. | ||||||||||||||||||||||||||||
| 2225 | |||||||||||||||||||||||||||||
| 2226 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 2227 | |||||||||||||||||||||||||||||
| 2228 | =over 4 | ||||||||||||||||||||||||||||
| 2229 | |||||||||||||||||||||||||||||
| 2230 | =item lt example 1 | ||||||||||||||||||||||||||||
| 2231 | |||||||||||||||||||||||||||||
| 2232 | package main; | ||||||||||||||||||||||||||||
| 2233 | |||||||||||||||||||||||||||||
| 2234 | use Venus::Array; | ||||||||||||||||||||||||||||
| 2235 | use Venus::String; | ||||||||||||||||||||||||||||
| 2236 | |||||||||||||||||||||||||||||
| 2237 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2238 | my $rvalue = Venus::Array->new; | ||||||||||||||||||||||||||||
| 2239 | |||||||||||||||||||||||||||||
| 2240 | my $result = $lvalue->lt($rvalue); | ||||||||||||||||||||||||||||
| 2241 | |||||||||||||||||||||||||||||
| 2242 | # 1 | ||||||||||||||||||||||||||||
| 2243 | |||||||||||||||||||||||||||||
| 2244 | =back | ||||||||||||||||||||||||||||
| 2245 | |||||||||||||||||||||||||||||
| 2246 | =over 4 | ||||||||||||||||||||||||||||
| 2247 | |||||||||||||||||||||||||||||
| 2248 | =item lt example 2 | ||||||||||||||||||||||||||||
| 2249 | |||||||||||||||||||||||||||||
| 2250 | package main; | ||||||||||||||||||||||||||||
| 2251 | |||||||||||||||||||||||||||||
| 2252 | use Venus::Code; | ||||||||||||||||||||||||||||
| 2253 | use Venus::String; | ||||||||||||||||||||||||||||
| 2254 | |||||||||||||||||||||||||||||
| 2255 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2256 | my $rvalue = Venus::Code->new; | ||||||||||||||||||||||||||||
| 2257 | |||||||||||||||||||||||||||||
| 2258 | my $result = $lvalue->lt($rvalue); | ||||||||||||||||||||||||||||
| 2259 | |||||||||||||||||||||||||||||
| 2260 | # 1 | ||||||||||||||||||||||||||||
| 2261 | |||||||||||||||||||||||||||||
| 2262 | =back | ||||||||||||||||||||||||||||
| 2263 | |||||||||||||||||||||||||||||
| 2264 | =over 4 | ||||||||||||||||||||||||||||
| 2265 | |||||||||||||||||||||||||||||
| 2266 | =item lt example 3 | ||||||||||||||||||||||||||||
| 2267 | |||||||||||||||||||||||||||||
| 2268 | package main; | ||||||||||||||||||||||||||||
| 2269 | |||||||||||||||||||||||||||||
| 2270 | use Venus::Float; | ||||||||||||||||||||||||||||
| 2271 | use Venus::String; | ||||||||||||||||||||||||||||
| 2272 | |||||||||||||||||||||||||||||
| 2273 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2274 | my $rvalue = Venus::Float->new; | ||||||||||||||||||||||||||||
| 2275 | |||||||||||||||||||||||||||||
| 2276 | my $result = $lvalue->lt($rvalue); | ||||||||||||||||||||||||||||
| 2277 | |||||||||||||||||||||||||||||
| 2278 | # 1 | ||||||||||||||||||||||||||||
| 2279 | |||||||||||||||||||||||||||||
| 2280 | =back | ||||||||||||||||||||||||||||
| 2281 | |||||||||||||||||||||||||||||
| 2282 | =over 4 | ||||||||||||||||||||||||||||
| 2283 | |||||||||||||||||||||||||||||
| 2284 | =item lt example 4 | ||||||||||||||||||||||||||||
| 2285 | |||||||||||||||||||||||||||||
| 2286 | package main; | ||||||||||||||||||||||||||||
| 2287 | |||||||||||||||||||||||||||||
| 2288 | use Venus::Hash; | ||||||||||||||||||||||||||||
| 2289 | use Venus::String; | ||||||||||||||||||||||||||||
| 2290 | |||||||||||||||||||||||||||||
| 2291 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2292 | my $rvalue = Venus::Hash->new; | ||||||||||||||||||||||||||||
| 2293 | |||||||||||||||||||||||||||||
| 2294 | my $result = $lvalue->lt($rvalue); | ||||||||||||||||||||||||||||
| 2295 | |||||||||||||||||||||||||||||
| 2296 | # 1 | ||||||||||||||||||||||||||||
| 2297 | |||||||||||||||||||||||||||||
| 2298 | =back | ||||||||||||||||||||||||||||
| 2299 | |||||||||||||||||||||||||||||
| 2300 | =over 4 | ||||||||||||||||||||||||||||
| 2301 | |||||||||||||||||||||||||||||
| 2302 | =item lt example 5 | ||||||||||||||||||||||||||||
| 2303 | |||||||||||||||||||||||||||||
| 2304 | package main; | ||||||||||||||||||||||||||||
| 2305 | |||||||||||||||||||||||||||||
| 2306 | use Venus::Number; | ||||||||||||||||||||||||||||
| 2307 | use Venus::String; | ||||||||||||||||||||||||||||
| 2308 | |||||||||||||||||||||||||||||
| 2309 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2310 | my $rvalue = Venus::Number->new; | ||||||||||||||||||||||||||||
| 2311 | |||||||||||||||||||||||||||||
| 2312 | my $result = $lvalue->lt($rvalue); | ||||||||||||||||||||||||||||
| 2313 | |||||||||||||||||||||||||||||
| 2314 | # 1 | ||||||||||||||||||||||||||||
| 2315 | |||||||||||||||||||||||||||||
| 2316 | =back | ||||||||||||||||||||||||||||
| 2317 | |||||||||||||||||||||||||||||
| 2318 | =over 4 | ||||||||||||||||||||||||||||
| 2319 | |||||||||||||||||||||||||||||
| 2320 | =item lt example 6 | ||||||||||||||||||||||||||||
| 2321 | |||||||||||||||||||||||||||||
| 2322 | package main; | ||||||||||||||||||||||||||||
| 2323 | |||||||||||||||||||||||||||||
| 2324 | use Venus::Regexp; | ||||||||||||||||||||||||||||
| 2325 | use Venus::String; | ||||||||||||||||||||||||||||
| 2326 | |||||||||||||||||||||||||||||
| 2327 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2328 | my $rvalue = Venus::Regexp->new; | ||||||||||||||||||||||||||||
| 2329 | |||||||||||||||||||||||||||||
| 2330 | my $result = $lvalue->lt($rvalue); | ||||||||||||||||||||||||||||
| 2331 | |||||||||||||||||||||||||||||
| 2332 | # 1 | ||||||||||||||||||||||||||||
| 2333 | |||||||||||||||||||||||||||||
| 2334 | =back | ||||||||||||||||||||||||||||
| 2335 | |||||||||||||||||||||||||||||
| 2336 | =over 4 | ||||||||||||||||||||||||||||
| 2337 | |||||||||||||||||||||||||||||
| 2338 | =item lt example 7 | ||||||||||||||||||||||||||||
| 2339 | |||||||||||||||||||||||||||||
| 2340 | package main; | ||||||||||||||||||||||||||||
| 2341 | |||||||||||||||||||||||||||||
| 2342 | use Venus::Scalar; | ||||||||||||||||||||||||||||
| 2343 | use Venus::String; | ||||||||||||||||||||||||||||
| 2344 | |||||||||||||||||||||||||||||
| 2345 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2346 | my $rvalue = Venus::Scalar->new; | ||||||||||||||||||||||||||||
| 2347 | |||||||||||||||||||||||||||||
| 2348 | my $result = $lvalue->lt($rvalue); | ||||||||||||||||||||||||||||
| 2349 | |||||||||||||||||||||||||||||
| 2350 | # 1 | ||||||||||||||||||||||||||||
| 2351 | |||||||||||||||||||||||||||||
| 2352 | =back | ||||||||||||||||||||||||||||
| 2353 | |||||||||||||||||||||||||||||
| 2354 | =over 4 | ||||||||||||||||||||||||||||
| 2355 | |||||||||||||||||||||||||||||
| 2356 | =item lt example 8 | ||||||||||||||||||||||||||||
| 2357 | |||||||||||||||||||||||||||||
| 2358 | package main; | ||||||||||||||||||||||||||||
| 2359 | |||||||||||||||||||||||||||||
| 2360 | use Venus::String; | ||||||||||||||||||||||||||||
| 2361 | |||||||||||||||||||||||||||||
| 2362 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2363 | my $rvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2364 | |||||||||||||||||||||||||||||
| 2365 | my $result = $lvalue->lt($rvalue); | ||||||||||||||||||||||||||||
| 2366 | |||||||||||||||||||||||||||||
| 2367 | # 0 | ||||||||||||||||||||||||||||
| 2368 | |||||||||||||||||||||||||||||
| 2369 | =back | ||||||||||||||||||||||||||||
| 2370 | |||||||||||||||||||||||||||||
| 2371 | =over 4 | ||||||||||||||||||||||||||||
| 2372 | |||||||||||||||||||||||||||||
| 2373 | =item lt example 9 | ||||||||||||||||||||||||||||
| 2374 | |||||||||||||||||||||||||||||
| 2375 | package main; | ||||||||||||||||||||||||||||
| 2376 | |||||||||||||||||||||||||||||
| 2377 | use Venus::String; | ||||||||||||||||||||||||||||
| 2378 | use Venus::Undef; | ||||||||||||||||||||||||||||
| 2379 | |||||||||||||||||||||||||||||
| 2380 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2381 | my $rvalue = Venus::Undef->new; | ||||||||||||||||||||||||||||
| 2382 | |||||||||||||||||||||||||||||
| 2383 | my $result = $lvalue->lt($rvalue); | ||||||||||||||||||||||||||||
| 2384 | |||||||||||||||||||||||||||||
| 2385 | # 0 | ||||||||||||||||||||||||||||
| 2386 | |||||||||||||||||||||||||||||
| 2387 | =back | ||||||||||||||||||||||||||||
| 2388 | |||||||||||||||||||||||||||||
| 2389 | =cut | ||||||||||||||||||||||||||||
| 2390 | |||||||||||||||||||||||||||||
| 2391 | =head2 ne | ||||||||||||||||||||||||||||
| 2392 | |||||||||||||||||||||||||||||
| 2393 | ne(any $arg) (boolean) | ||||||||||||||||||||||||||||
| 2394 | |||||||||||||||||||||||||||||
| 2395 | The ne method performs a I<"not-equal-to"> operation using the argument provided. | ||||||||||||||||||||||||||||
| 2396 | |||||||||||||||||||||||||||||
| 2397 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 2398 | |||||||||||||||||||||||||||||
| 2399 | =over 4 | ||||||||||||||||||||||||||||
| 2400 | |||||||||||||||||||||||||||||
| 2401 | =item ne example 1 | ||||||||||||||||||||||||||||
| 2402 | |||||||||||||||||||||||||||||
| 2403 | package main; | ||||||||||||||||||||||||||||
| 2404 | |||||||||||||||||||||||||||||
| 2405 | use Venus::Array; | ||||||||||||||||||||||||||||
| 2406 | use Venus::String; | ||||||||||||||||||||||||||||
| 2407 | |||||||||||||||||||||||||||||
| 2408 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2409 | my $rvalue = Venus::Array->new; | ||||||||||||||||||||||||||||
| 2410 | |||||||||||||||||||||||||||||
| 2411 | my $result = $lvalue->ne($rvalue); | ||||||||||||||||||||||||||||
| 2412 | |||||||||||||||||||||||||||||
| 2413 | # 1 | ||||||||||||||||||||||||||||
| 2414 | |||||||||||||||||||||||||||||
| 2415 | =back | ||||||||||||||||||||||||||||
| 2416 | |||||||||||||||||||||||||||||
| 2417 | =over 4 | ||||||||||||||||||||||||||||
| 2418 | |||||||||||||||||||||||||||||
| 2419 | =item ne example 2 | ||||||||||||||||||||||||||||
| 2420 | |||||||||||||||||||||||||||||
| 2421 | package main; | ||||||||||||||||||||||||||||
| 2422 | |||||||||||||||||||||||||||||
| 2423 | use Venus::Code; | ||||||||||||||||||||||||||||
| 2424 | use Venus::String; | ||||||||||||||||||||||||||||
| 2425 | |||||||||||||||||||||||||||||
| 2426 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2427 | my $rvalue = Venus::Code->new; | ||||||||||||||||||||||||||||
| 2428 | |||||||||||||||||||||||||||||
| 2429 | my $result = $lvalue->ne($rvalue); | ||||||||||||||||||||||||||||
| 2430 | |||||||||||||||||||||||||||||
| 2431 | # 1 | ||||||||||||||||||||||||||||
| 2432 | |||||||||||||||||||||||||||||
| 2433 | =back | ||||||||||||||||||||||||||||
| 2434 | |||||||||||||||||||||||||||||
| 2435 | =over 4 | ||||||||||||||||||||||||||||
| 2436 | |||||||||||||||||||||||||||||
| 2437 | =item ne example 3 | ||||||||||||||||||||||||||||
| 2438 | |||||||||||||||||||||||||||||
| 2439 | package main; | ||||||||||||||||||||||||||||
| 2440 | |||||||||||||||||||||||||||||
| 2441 | use Venus::Float; | ||||||||||||||||||||||||||||
| 2442 | use Venus::String; | ||||||||||||||||||||||||||||
| 2443 | |||||||||||||||||||||||||||||
| 2444 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2445 | my $rvalue = Venus::Float->new; | ||||||||||||||||||||||||||||
| 2446 | |||||||||||||||||||||||||||||
| 2447 | my $result = $lvalue->ne($rvalue); | ||||||||||||||||||||||||||||
| 2448 | |||||||||||||||||||||||||||||
| 2449 | # 1 | ||||||||||||||||||||||||||||
| 2450 | |||||||||||||||||||||||||||||
| 2451 | =back | ||||||||||||||||||||||||||||
| 2452 | |||||||||||||||||||||||||||||
| 2453 | =over 4 | ||||||||||||||||||||||||||||
| 2454 | |||||||||||||||||||||||||||||
| 2455 | =item ne example 4 | ||||||||||||||||||||||||||||
| 2456 | |||||||||||||||||||||||||||||
| 2457 | package main; | ||||||||||||||||||||||||||||
| 2458 | |||||||||||||||||||||||||||||
| 2459 | use Venus::Hash; | ||||||||||||||||||||||||||||
| 2460 | use Venus::String; | ||||||||||||||||||||||||||||
| 2461 | |||||||||||||||||||||||||||||
| 2462 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2463 | my $rvalue = Venus::Hash->new; | ||||||||||||||||||||||||||||
| 2464 | |||||||||||||||||||||||||||||
| 2465 | my $result = $lvalue->ne($rvalue); | ||||||||||||||||||||||||||||
| 2466 | |||||||||||||||||||||||||||||
| 2467 | # 1 | ||||||||||||||||||||||||||||
| 2468 | |||||||||||||||||||||||||||||
| 2469 | =back | ||||||||||||||||||||||||||||
| 2470 | |||||||||||||||||||||||||||||
| 2471 | =over 4 | ||||||||||||||||||||||||||||
| 2472 | |||||||||||||||||||||||||||||
| 2473 | =item ne example 5 | ||||||||||||||||||||||||||||
| 2474 | |||||||||||||||||||||||||||||
| 2475 | package main; | ||||||||||||||||||||||||||||
| 2476 | |||||||||||||||||||||||||||||
| 2477 | use Venus::Number; | ||||||||||||||||||||||||||||
| 2478 | use Venus::String; | ||||||||||||||||||||||||||||
| 2479 | |||||||||||||||||||||||||||||
| 2480 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2481 | my $rvalue = Venus::Number->new; | ||||||||||||||||||||||||||||
| 2482 | |||||||||||||||||||||||||||||
| 2483 | my $result = $lvalue->ne($rvalue); | ||||||||||||||||||||||||||||
| 2484 | |||||||||||||||||||||||||||||
| 2485 | # 1 | ||||||||||||||||||||||||||||
| 2486 | |||||||||||||||||||||||||||||
| 2487 | =back | ||||||||||||||||||||||||||||
| 2488 | |||||||||||||||||||||||||||||
| 2489 | =over 4 | ||||||||||||||||||||||||||||
| 2490 | |||||||||||||||||||||||||||||
| 2491 | =item ne example 6 | ||||||||||||||||||||||||||||
| 2492 | |||||||||||||||||||||||||||||
| 2493 | package main; | ||||||||||||||||||||||||||||
| 2494 | |||||||||||||||||||||||||||||
| 2495 | use Venus::Regexp; | ||||||||||||||||||||||||||||
| 2496 | use Venus::String; | ||||||||||||||||||||||||||||
| 2497 | |||||||||||||||||||||||||||||
| 2498 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2499 | my $rvalue = Venus::Regexp->new; | ||||||||||||||||||||||||||||
| 2500 | |||||||||||||||||||||||||||||
| 2501 | my $result = $lvalue->ne($rvalue); | ||||||||||||||||||||||||||||
| 2502 | |||||||||||||||||||||||||||||
| 2503 | # 1 | ||||||||||||||||||||||||||||
| 2504 | |||||||||||||||||||||||||||||
| 2505 | =back | ||||||||||||||||||||||||||||
| 2506 | |||||||||||||||||||||||||||||
| 2507 | =over 4 | ||||||||||||||||||||||||||||
| 2508 | |||||||||||||||||||||||||||||
| 2509 | =item ne example 7 | ||||||||||||||||||||||||||||
| 2510 | |||||||||||||||||||||||||||||
| 2511 | package main; | ||||||||||||||||||||||||||||
| 2512 | |||||||||||||||||||||||||||||
| 2513 | use Venus::Scalar; | ||||||||||||||||||||||||||||
| 2514 | use Venus::String; | ||||||||||||||||||||||||||||
| 2515 | |||||||||||||||||||||||||||||
| 2516 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2517 | my $rvalue = Venus::Scalar->new; | ||||||||||||||||||||||||||||
| 2518 | |||||||||||||||||||||||||||||
| 2519 | my $result = $lvalue->ne($rvalue); | ||||||||||||||||||||||||||||
| 2520 | |||||||||||||||||||||||||||||
| 2521 | # 1 | ||||||||||||||||||||||||||||
| 2522 | |||||||||||||||||||||||||||||
| 2523 | =back | ||||||||||||||||||||||||||||
| 2524 | |||||||||||||||||||||||||||||
| 2525 | =over 4 | ||||||||||||||||||||||||||||
| 2526 | |||||||||||||||||||||||||||||
| 2527 | =item ne example 8 | ||||||||||||||||||||||||||||
| 2528 | |||||||||||||||||||||||||||||
| 2529 | package main; | ||||||||||||||||||||||||||||
| 2530 | |||||||||||||||||||||||||||||
| 2531 | use Venus::String; | ||||||||||||||||||||||||||||
| 2532 | |||||||||||||||||||||||||||||
| 2533 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2534 | my $rvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2535 | |||||||||||||||||||||||||||||
| 2536 | my $result = $lvalue->ne($rvalue); | ||||||||||||||||||||||||||||
| 2537 | |||||||||||||||||||||||||||||
| 2538 | # 0 | ||||||||||||||||||||||||||||
| 2539 | |||||||||||||||||||||||||||||
| 2540 | =back | ||||||||||||||||||||||||||||
| 2541 | |||||||||||||||||||||||||||||
| 2542 | =over 4 | ||||||||||||||||||||||||||||
| 2543 | |||||||||||||||||||||||||||||
| 2544 | =item ne example 9 | ||||||||||||||||||||||||||||
| 2545 | |||||||||||||||||||||||||||||
| 2546 | package main; | ||||||||||||||||||||||||||||
| 2547 | |||||||||||||||||||||||||||||
| 2548 | use Venus::String; | ||||||||||||||||||||||||||||
| 2549 | use Venus::Undef; | ||||||||||||||||||||||||||||
| 2550 | |||||||||||||||||||||||||||||
| 2551 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2552 | my $rvalue = Venus::Undef->new; | ||||||||||||||||||||||||||||
| 2553 | |||||||||||||||||||||||||||||
| 2554 | my $result = $lvalue->ne($rvalue); | ||||||||||||||||||||||||||||
| 2555 | |||||||||||||||||||||||||||||
| 2556 | # 0 | ||||||||||||||||||||||||||||
| 2557 | |||||||||||||||||||||||||||||
| 2558 | =back | ||||||||||||||||||||||||||||
| 2559 | |||||||||||||||||||||||||||||
| 2560 | =cut | ||||||||||||||||||||||||||||
| 2561 | |||||||||||||||||||||||||||||
| 2562 | =head2 new | ||||||||||||||||||||||||||||
| 2563 | |||||||||||||||||||||||||||||
| 2564 | new(any @args) (Venus::String) | ||||||||||||||||||||||||||||
| 2565 | |||||||||||||||||||||||||||||
| 2566 | The new method constructs an instance of the package. | ||||||||||||||||||||||||||||
| 2567 | |||||||||||||||||||||||||||||
| 2568 | I<Since C<4.15>> | ||||||||||||||||||||||||||||
| 2569 | |||||||||||||||||||||||||||||
| 2570 | =over 4 | ||||||||||||||||||||||||||||
| 2571 | |||||||||||||||||||||||||||||
| 2572 | =item new example 1 | ||||||||||||||||||||||||||||
| 2573 | |||||||||||||||||||||||||||||
| 2574 | package main; | ||||||||||||||||||||||||||||
| 2575 | |||||||||||||||||||||||||||||
| 2576 | use Venus::String; | ||||||||||||||||||||||||||||
| 2577 | |||||||||||||||||||||||||||||
| 2578 | my $new = Venus::String->new; | ||||||||||||||||||||||||||||
| 2579 | |||||||||||||||||||||||||||||
| 2580 | # bless(..., "Venus::String") | ||||||||||||||||||||||||||||
| 2581 | |||||||||||||||||||||||||||||
| 2582 | =back | ||||||||||||||||||||||||||||
| 2583 | |||||||||||||||||||||||||||||
| 2584 | =over 4 | ||||||||||||||||||||||||||||
| 2585 | |||||||||||||||||||||||||||||
| 2586 | =item new example 2 | ||||||||||||||||||||||||||||
| 2587 | |||||||||||||||||||||||||||||
| 2588 | package main; | ||||||||||||||||||||||||||||
| 2589 | |||||||||||||||||||||||||||||
| 2590 | use Venus::String; | ||||||||||||||||||||||||||||
| 2591 | |||||||||||||||||||||||||||||
| 2592 | my $new = Venus::String->new('hello world'); | ||||||||||||||||||||||||||||
| 2593 | |||||||||||||||||||||||||||||
| 2594 | # bless(..., "Venus::String") | ||||||||||||||||||||||||||||
| 2595 | |||||||||||||||||||||||||||||
| 2596 | =back | ||||||||||||||||||||||||||||
| 2597 | |||||||||||||||||||||||||||||
| 2598 | =over 4 | ||||||||||||||||||||||||||||
| 2599 | |||||||||||||||||||||||||||||
| 2600 | =item new example 3 | ||||||||||||||||||||||||||||
| 2601 | |||||||||||||||||||||||||||||
| 2602 | package main; | ||||||||||||||||||||||||||||
| 2603 | |||||||||||||||||||||||||||||
| 2604 | use Venus::String; | ||||||||||||||||||||||||||||
| 2605 | |||||||||||||||||||||||||||||
| 2606 | my $new = Venus::String->new(value => 'hello world'); | ||||||||||||||||||||||||||||
| 2607 | |||||||||||||||||||||||||||||
| 2608 | # bless(..., "Venus::String") | ||||||||||||||||||||||||||||
| 2609 | |||||||||||||||||||||||||||||
| 2610 | =back | ||||||||||||||||||||||||||||
| 2611 | |||||||||||||||||||||||||||||
| 2612 | =cut | ||||||||||||||||||||||||||||
| 2613 | |||||||||||||||||||||||||||||
| 2614 | =head2 numified | ||||||||||||||||||||||||||||
| 2615 | |||||||||||||||||||||||||||||
| 2616 | numified() (number) | ||||||||||||||||||||||||||||
| 2617 | |||||||||||||||||||||||||||||
| 2618 | The numified method returns the numerical representation of the object. For | ||||||||||||||||||||||||||||
| 2619 | string objects this method returns the underlying value, if that value looks | ||||||||||||||||||||||||||||
| 2620 | like a number, or C<0>. | ||||||||||||||||||||||||||||
| 2621 | |||||||||||||||||||||||||||||
| 2622 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 2623 | |||||||||||||||||||||||||||||
| 2624 | =over 4 | ||||||||||||||||||||||||||||
| 2625 | |||||||||||||||||||||||||||||
| 2626 | =item numified example 1 | ||||||||||||||||||||||||||||
| 2627 | |||||||||||||||||||||||||||||
| 2628 | # given: synopsis; | ||||||||||||||||||||||||||||
| 2629 | |||||||||||||||||||||||||||||
| 2630 | my $numified = $string->numified; | ||||||||||||||||||||||||||||
| 2631 | |||||||||||||||||||||||||||||
| 2632 | # 11 | ||||||||||||||||||||||||||||
| 2633 | |||||||||||||||||||||||||||||
| 2634 | =back | ||||||||||||||||||||||||||||
| 2635 | |||||||||||||||||||||||||||||
| 2636 | =over 4 | ||||||||||||||||||||||||||||
| 2637 | |||||||||||||||||||||||||||||
| 2638 | =item numified example 2 | ||||||||||||||||||||||||||||
| 2639 | |||||||||||||||||||||||||||||
| 2640 | package main; | ||||||||||||||||||||||||||||
| 2641 | |||||||||||||||||||||||||||||
| 2642 | use Venus::String; | ||||||||||||||||||||||||||||
| 2643 | |||||||||||||||||||||||||||||
| 2644 | my $string = Venus::String->new(1_000_000); | ||||||||||||||||||||||||||||
| 2645 | |||||||||||||||||||||||||||||
| 2646 | my $numified = $string->numified; | ||||||||||||||||||||||||||||
| 2647 | |||||||||||||||||||||||||||||
| 2648 | # 1000000 | ||||||||||||||||||||||||||||
| 2649 | |||||||||||||||||||||||||||||
| 2650 | =back | ||||||||||||||||||||||||||||
| 2651 | |||||||||||||||||||||||||||||
| 2652 | =cut | ||||||||||||||||||||||||||||
| 2653 | |||||||||||||||||||||||||||||
| 2654 | =head2 pascalcase | ||||||||||||||||||||||||||||
| 2655 | |||||||||||||||||||||||||||||
| 2656 | pascalcase() (string) | ||||||||||||||||||||||||||||
| 2657 | |||||||||||||||||||||||||||||
| 2658 | The pascalcase method converts the string to pascalcase. | ||||||||||||||||||||||||||||
| 2659 | |||||||||||||||||||||||||||||
| 2660 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2661 | |||||||||||||||||||||||||||||
| 2662 | =over 4 | ||||||||||||||||||||||||||||
| 2663 | |||||||||||||||||||||||||||||
| 2664 | =item pascalcase example 1 | ||||||||||||||||||||||||||||
| 2665 | |||||||||||||||||||||||||||||
| 2666 | # given: synopsis; | ||||||||||||||||||||||||||||
| 2667 | |||||||||||||||||||||||||||||
| 2668 | my $pascalcase = $string->pascalcase; | ||||||||||||||||||||||||||||
| 2669 | |||||||||||||||||||||||||||||
| 2670 | # "HelloWorld" | ||||||||||||||||||||||||||||
| 2671 | |||||||||||||||||||||||||||||
| 2672 | =back | ||||||||||||||||||||||||||||
| 2673 | |||||||||||||||||||||||||||||
| 2674 | =cut | ||||||||||||||||||||||||||||
| 2675 | |||||||||||||||||||||||||||||
| 2676 | =head2 prepend | ||||||||||||||||||||||||||||
| 2677 | |||||||||||||||||||||||||||||
| 2678 | prepend(string @parts) (string) | ||||||||||||||||||||||||||||
| 2679 | |||||||||||||||||||||||||||||
| 2680 | The prepend method prepends arugments to the string using spaces. | ||||||||||||||||||||||||||||
| 2681 | |||||||||||||||||||||||||||||
| 2682 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2683 | |||||||||||||||||||||||||||||
| 2684 | =over 4 | ||||||||||||||||||||||||||||
| 2685 | |||||||||||||||||||||||||||||
| 2686 | =item prepend example 1 | ||||||||||||||||||||||||||||
| 2687 | |||||||||||||||||||||||||||||
| 2688 | # given: synopsis; | ||||||||||||||||||||||||||||
| 2689 | |||||||||||||||||||||||||||||
| 2690 | my $prepend = $string->prepend('welcome'); | ||||||||||||||||||||||||||||
| 2691 | |||||||||||||||||||||||||||||
| 2692 | # "welcome hello world" | ||||||||||||||||||||||||||||
| 2693 | |||||||||||||||||||||||||||||
| 2694 | =back | ||||||||||||||||||||||||||||
| 2695 | |||||||||||||||||||||||||||||
| 2696 | =cut | ||||||||||||||||||||||||||||
| 2697 | |||||||||||||||||||||||||||||
| 2698 | =head2 prepend_with | ||||||||||||||||||||||||||||
| 2699 | |||||||||||||||||||||||||||||
| 2700 | prepend_with(string $delimiter, string @parts) (string) | ||||||||||||||||||||||||||||
| 2701 | |||||||||||||||||||||||||||||
| 2702 | The prepend_with method prepends arugments to the string using the delimiter | ||||||||||||||||||||||||||||
| 2703 | provided. | ||||||||||||||||||||||||||||
| 2704 | |||||||||||||||||||||||||||||
| 2705 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2706 | |||||||||||||||||||||||||||||
| 2707 | =over 4 | ||||||||||||||||||||||||||||
| 2708 | |||||||||||||||||||||||||||||
| 2709 | =item prepend_with example 1 | ||||||||||||||||||||||||||||
| 2710 | |||||||||||||||||||||||||||||
| 2711 | # given: synopsis; | ||||||||||||||||||||||||||||
| 2712 | |||||||||||||||||||||||||||||
| 2713 | my $prepend = $string->prepend_with(', ', 'welcome'); | ||||||||||||||||||||||||||||
| 2714 | |||||||||||||||||||||||||||||
| 2715 | # "welcome, hello world" | ||||||||||||||||||||||||||||
| 2716 | |||||||||||||||||||||||||||||
| 2717 | =back | ||||||||||||||||||||||||||||
| 2718 | |||||||||||||||||||||||||||||
| 2719 | =cut | ||||||||||||||||||||||||||||
| 2720 | |||||||||||||||||||||||||||||
| 2721 | =head2 render | ||||||||||||||||||||||||||||
| 2722 | |||||||||||||||||||||||||||||
| 2723 | render(hashref $tokens) (string) | ||||||||||||||||||||||||||||
| 2724 | |||||||||||||||||||||||||||||
| 2725 | The render method treats the string as a template and performs a simple token | ||||||||||||||||||||||||||||
| 2726 | replacement using the argument provided. | ||||||||||||||||||||||||||||
| 2727 | |||||||||||||||||||||||||||||
| 2728 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2729 | |||||||||||||||||||||||||||||
| 2730 | =over 4 | ||||||||||||||||||||||||||||
| 2731 | |||||||||||||||||||||||||||||
| 2732 | =item render example 1 | ||||||||||||||||||||||||||||
| 2733 | |||||||||||||||||||||||||||||
| 2734 | package main; | ||||||||||||||||||||||||||||
| 2735 | |||||||||||||||||||||||||||||
| 2736 | use Venus::String; | ||||||||||||||||||||||||||||
| 2737 | |||||||||||||||||||||||||||||
| 2738 | my $string = Venus::String->new('Hi, {{name}}!'); | ||||||||||||||||||||||||||||
| 2739 | |||||||||||||||||||||||||||||
| 2740 | my $render = $string->render({name => 'Friend'}); | ||||||||||||||||||||||||||||
| 2741 | |||||||||||||||||||||||||||||
| 2742 | # "Hi, Friend!" | ||||||||||||||||||||||||||||
| 2743 | |||||||||||||||||||||||||||||
| 2744 | =back | ||||||||||||||||||||||||||||
| 2745 | |||||||||||||||||||||||||||||
| 2746 | =cut | ||||||||||||||||||||||||||||
| 2747 | |||||||||||||||||||||||||||||
| 2748 | =head2 repeat | ||||||||||||||||||||||||||||
| 2749 | |||||||||||||||||||||||||||||
| 2750 | repeat(number $number, string $delimiter) (string) | ||||||||||||||||||||||||||||
| 2751 | |||||||||||||||||||||||||||||
| 2752 | The repeat method repeats the string value N times based on the number provided | ||||||||||||||||||||||||||||
| 2753 | and returns a new concatenated string. Optionally, a delimiter can be provided | ||||||||||||||||||||||||||||
| 2754 | and be place between the occurences. | ||||||||||||||||||||||||||||
| 2755 | |||||||||||||||||||||||||||||
| 2756 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2757 | |||||||||||||||||||||||||||||
| 2758 | =over 4 | ||||||||||||||||||||||||||||
| 2759 | |||||||||||||||||||||||||||||
| 2760 | =item repeat example 1 | ||||||||||||||||||||||||||||
| 2761 | |||||||||||||||||||||||||||||
| 2762 | package main; | ||||||||||||||||||||||||||||
| 2763 | |||||||||||||||||||||||||||||
| 2764 | use Venus::String; | ||||||||||||||||||||||||||||
| 2765 | |||||||||||||||||||||||||||||
| 2766 | my $string = Venus::String->new('999'); | ||||||||||||||||||||||||||||
| 2767 | |||||||||||||||||||||||||||||
| 2768 | my $repeat = $string->repeat(2); | ||||||||||||||||||||||||||||
| 2769 | |||||||||||||||||||||||||||||
| 2770 | # "999999" | ||||||||||||||||||||||||||||
| 2771 | |||||||||||||||||||||||||||||
| 2772 | =back | ||||||||||||||||||||||||||||
| 2773 | |||||||||||||||||||||||||||||
| 2774 | =over 4 | ||||||||||||||||||||||||||||
| 2775 | |||||||||||||||||||||||||||||
| 2776 | =item repeat example 2 | ||||||||||||||||||||||||||||
| 2777 | |||||||||||||||||||||||||||||
| 2778 | package main; | ||||||||||||||||||||||||||||
| 2779 | |||||||||||||||||||||||||||||
| 2780 | use Venus::String; | ||||||||||||||||||||||||||||
| 2781 | |||||||||||||||||||||||||||||
| 2782 | my $string = Venus::String->new('999'); | ||||||||||||||||||||||||||||
| 2783 | |||||||||||||||||||||||||||||
| 2784 | my $repeat = $string->repeat(2, ','); | ||||||||||||||||||||||||||||
| 2785 | |||||||||||||||||||||||||||||
| 2786 | # "999,999" | ||||||||||||||||||||||||||||
| 2787 | |||||||||||||||||||||||||||||
| 2788 | =back | ||||||||||||||||||||||||||||
| 2789 | |||||||||||||||||||||||||||||
| 2790 | =cut | ||||||||||||||||||||||||||||
| 2791 | |||||||||||||||||||||||||||||
| 2792 | =head2 replace | ||||||||||||||||||||||||||||
| 2793 | |||||||||||||||||||||||||||||
| 2794 | replace(regexp $regexp, string $replace, string $flags) (Venus::Replace) | ||||||||||||||||||||||||||||
| 2795 | |||||||||||||||||||||||||||||
| 2796 | The replace method performs a search and replace operation and returns the | ||||||||||||||||||||||||||||
| 2797 | L<Venus::Replace> object. | ||||||||||||||||||||||||||||
| 2798 | |||||||||||||||||||||||||||||
| 2799 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2800 | |||||||||||||||||||||||||||||
| 2801 | =over 4 | ||||||||||||||||||||||||||||
| 2802 | |||||||||||||||||||||||||||||
| 2803 | =item replace example 1 | ||||||||||||||||||||||||||||
| 2804 | |||||||||||||||||||||||||||||
| 2805 | # given: synopsis; | ||||||||||||||||||||||||||||
| 2806 | |||||||||||||||||||||||||||||
| 2807 | my $replace = $string->replace('world', 'universe'); | ||||||||||||||||||||||||||||
| 2808 | |||||||||||||||||||||||||||||
| 2809 | # bless({ | ||||||||||||||||||||||||||||
| 2810 | # ..., | ||||||||||||||||||||||||||||
| 2811 | # "flags" => "", | ||||||||||||||||||||||||||||
| 2812 | # "regexp" => "world", | ||||||||||||||||||||||||||||
| 2813 | # "string" => "hello world", | ||||||||||||||||||||||||||||
| 2814 | # "substr" => "universe", | ||||||||||||||||||||||||||||
| 2815 | # }, "Venus::Replace") | ||||||||||||||||||||||||||||
| 2816 | |||||||||||||||||||||||||||||
| 2817 | =back | ||||||||||||||||||||||||||||
| 2818 | |||||||||||||||||||||||||||||
| 2819 | =cut | ||||||||||||||||||||||||||||
| 2820 | |||||||||||||||||||||||||||||
| 2821 | =head2 reverse | ||||||||||||||||||||||||||||
| 2822 | |||||||||||||||||||||||||||||
| 2823 | reverse() (string) | ||||||||||||||||||||||||||||
| 2824 | |||||||||||||||||||||||||||||
| 2825 | The reverse method returns a string where the characters in the string are in | ||||||||||||||||||||||||||||
| 2826 | the opposite order. | ||||||||||||||||||||||||||||
| 2827 | |||||||||||||||||||||||||||||
| 2828 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2829 | |||||||||||||||||||||||||||||
| 2830 | =over 4 | ||||||||||||||||||||||||||||
| 2831 | |||||||||||||||||||||||||||||
| 2832 | =item reverse example 1 | ||||||||||||||||||||||||||||
| 2833 | |||||||||||||||||||||||||||||
| 2834 | # given: synopsis; | ||||||||||||||||||||||||||||
| 2835 | |||||||||||||||||||||||||||||
| 2836 | my $reverse = $string->reverse; | ||||||||||||||||||||||||||||
| 2837 | |||||||||||||||||||||||||||||
| 2838 | # "dlrow olleh" | ||||||||||||||||||||||||||||
| 2839 | |||||||||||||||||||||||||||||
| 2840 | =back | ||||||||||||||||||||||||||||
| 2841 | |||||||||||||||||||||||||||||
| 2842 | =cut | ||||||||||||||||||||||||||||
| 2843 | |||||||||||||||||||||||||||||
| 2844 | =head2 rindex | ||||||||||||||||||||||||||||
| 2845 | |||||||||||||||||||||||||||||
| 2846 | rindex(string $substr, number $start) (string) | ||||||||||||||||||||||||||||
| 2847 | |||||||||||||||||||||||||||||
| 2848 | The rindex method searches for the argument within the string and returns the | ||||||||||||||||||||||||||||
| 2849 | position of the last occurrence of the argument. | ||||||||||||||||||||||||||||
| 2850 | |||||||||||||||||||||||||||||
| 2851 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2852 | |||||||||||||||||||||||||||||
| 2853 | =over 4 | ||||||||||||||||||||||||||||
| 2854 | |||||||||||||||||||||||||||||
| 2855 | =item rindex example 1 | ||||||||||||||||||||||||||||
| 2856 | |||||||||||||||||||||||||||||
| 2857 | package main; | ||||||||||||||||||||||||||||
| 2858 | |||||||||||||||||||||||||||||
| 2859 | use Venus::String; | ||||||||||||||||||||||||||||
| 2860 | |||||||||||||||||||||||||||||
| 2861 | my $string = Venus::String->new('explain the unexplainable'); | ||||||||||||||||||||||||||||
| 2862 | |||||||||||||||||||||||||||||
| 2863 | my $rindex = $string->rindex('explain'); | ||||||||||||||||||||||||||||
| 2864 | |||||||||||||||||||||||||||||
| 2865 | # 14 | ||||||||||||||||||||||||||||
| 2866 | |||||||||||||||||||||||||||||
| 2867 | =back | ||||||||||||||||||||||||||||
| 2868 | |||||||||||||||||||||||||||||
| 2869 | =over 4 | ||||||||||||||||||||||||||||
| 2870 | |||||||||||||||||||||||||||||
| 2871 | =item rindex example 2 | ||||||||||||||||||||||||||||
| 2872 | |||||||||||||||||||||||||||||
| 2873 | package main; | ||||||||||||||||||||||||||||
| 2874 | |||||||||||||||||||||||||||||
| 2875 | use Venus::String; | ||||||||||||||||||||||||||||
| 2876 | |||||||||||||||||||||||||||||
| 2877 | my $string = Venus::String->new('explain the unexplainable'); | ||||||||||||||||||||||||||||
| 2878 | |||||||||||||||||||||||||||||
| 2879 | my $rindex = $string->rindex('explained'); | ||||||||||||||||||||||||||||
| 2880 | |||||||||||||||||||||||||||||
| 2881 | # -1 | ||||||||||||||||||||||||||||
| 2882 | |||||||||||||||||||||||||||||
| 2883 | =back | ||||||||||||||||||||||||||||
| 2884 | |||||||||||||||||||||||||||||
| 2885 | =over 4 | ||||||||||||||||||||||||||||
| 2886 | |||||||||||||||||||||||||||||
| 2887 | =item rindex example 3 | ||||||||||||||||||||||||||||
| 2888 | |||||||||||||||||||||||||||||
| 2889 | package main; | ||||||||||||||||||||||||||||
| 2890 | |||||||||||||||||||||||||||||
| 2891 | use Venus::String; | ||||||||||||||||||||||||||||
| 2892 | |||||||||||||||||||||||||||||
| 2893 | my $string = Venus::String->new('explain the unexplainable'); | ||||||||||||||||||||||||||||
| 2894 | |||||||||||||||||||||||||||||
| 2895 | my $rindex = $string->rindex('explain', 21); | ||||||||||||||||||||||||||||
| 2896 | |||||||||||||||||||||||||||||
| 2897 | # 14 | ||||||||||||||||||||||||||||
| 2898 | |||||||||||||||||||||||||||||
| 2899 | =back | ||||||||||||||||||||||||||||
| 2900 | |||||||||||||||||||||||||||||
| 2901 | =cut | ||||||||||||||||||||||||||||
| 2902 | |||||||||||||||||||||||||||||
| 2903 | =head2 search | ||||||||||||||||||||||||||||
| 2904 | |||||||||||||||||||||||||||||
| 2905 | search(regexp $regexp) (Venus::Search) | ||||||||||||||||||||||||||||
| 2906 | |||||||||||||||||||||||||||||
| 2907 | The search method performs a search operation and returns the L<Venus::Search> | ||||||||||||||||||||||||||||
| 2908 | object. | ||||||||||||||||||||||||||||
| 2909 | |||||||||||||||||||||||||||||
| 2910 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2911 | |||||||||||||||||||||||||||||
| 2912 | =over 4 | ||||||||||||||||||||||||||||
| 2913 | |||||||||||||||||||||||||||||
| 2914 | =item search example 1 | ||||||||||||||||||||||||||||
| 2915 | |||||||||||||||||||||||||||||
| 2916 | # given: synopsis; | ||||||||||||||||||||||||||||
| 2917 | |||||||||||||||||||||||||||||
| 2918 | my $search = $string->search('world'); | ||||||||||||||||||||||||||||
| 2919 | |||||||||||||||||||||||||||||
| 2920 | # bless({ | ||||||||||||||||||||||||||||
| 2921 | # ..., | ||||||||||||||||||||||||||||
| 2922 | # "flags" => "", | ||||||||||||||||||||||||||||
| 2923 | # "regexp" => "world", | ||||||||||||||||||||||||||||
| 2924 | # "string" => "hello world", | ||||||||||||||||||||||||||||
| 2925 | # }, "Venus::Search") | ||||||||||||||||||||||||||||
| 2926 | |||||||||||||||||||||||||||||
| 2927 | =back | ||||||||||||||||||||||||||||
| 2928 | |||||||||||||||||||||||||||||
| 2929 | =cut | ||||||||||||||||||||||||||||
| 2930 | |||||||||||||||||||||||||||||
| 2931 | =head2 snakecase | ||||||||||||||||||||||||||||
| 2932 | |||||||||||||||||||||||||||||
| 2933 | snakecase() (string) | ||||||||||||||||||||||||||||
| 2934 | |||||||||||||||||||||||||||||
| 2935 | The snakecase method converts the string to snakecase. | ||||||||||||||||||||||||||||
| 2936 | |||||||||||||||||||||||||||||
| 2937 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2938 | |||||||||||||||||||||||||||||
| 2939 | =over 4 | ||||||||||||||||||||||||||||
| 2940 | |||||||||||||||||||||||||||||
| 2941 | =item snakecase example 1 | ||||||||||||||||||||||||||||
| 2942 | |||||||||||||||||||||||||||||
| 2943 | # given: synopsis; | ||||||||||||||||||||||||||||
| 2944 | |||||||||||||||||||||||||||||
| 2945 | my $snakecase = $string->snakecase; | ||||||||||||||||||||||||||||
| 2946 | |||||||||||||||||||||||||||||
| 2947 | # "hello_world" | ||||||||||||||||||||||||||||
| 2948 | |||||||||||||||||||||||||||||
| 2949 | =back | ||||||||||||||||||||||||||||
| 2950 | |||||||||||||||||||||||||||||
| 2951 | =cut | ||||||||||||||||||||||||||||
| 2952 | |||||||||||||||||||||||||||||
| 2953 | =head2 split | ||||||||||||||||||||||||||||
| 2954 | |||||||||||||||||||||||||||||
| 2955 | split(string | regexp $expr, maybe[number] $limit) (arrayref) | ||||||||||||||||||||||||||||
| 2956 | |||||||||||||||||||||||||||||
| 2957 | The split method returns an arrayref by splitting the string on the argument. | ||||||||||||||||||||||||||||
| 2958 | |||||||||||||||||||||||||||||
| 2959 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2960 | |||||||||||||||||||||||||||||
| 2961 | =over 4 | ||||||||||||||||||||||||||||
| 2962 | |||||||||||||||||||||||||||||
| 2963 | =item split example 1 | ||||||||||||||||||||||||||||
| 2964 | |||||||||||||||||||||||||||||
| 2965 | package main; | ||||||||||||||||||||||||||||
| 2966 | |||||||||||||||||||||||||||||
| 2967 | use Venus::String; | ||||||||||||||||||||||||||||
| 2968 | |||||||||||||||||||||||||||||
| 2969 | my $string = Venus::String->new('name, age, dob, email'); | ||||||||||||||||||||||||||||
| 2970 | |||||||||||||||||||||||||||||
| 2971 | my $split = $string->split(', '); | ||||||||||||||||||||||||||||
| 2972 | |||||||||||||||||||||||||||||
| 2973 | # ["name", "age", "dob", "email"] | ||||||||||||||||||||||||||||
| 2974 | |||||||||||||||||||||||||||||
| 2975 | =back | ||||||||||||||||||||||||||||
| 2976 | |||||||||||||||||||||||||||||
| 2977 | =over 4 | ||||||||||||||||||||||||||||
| 2978 | |||||||||||||||||||||||||||||
| 2979 | =item split example 2 | ||||||||||||||||||||||||||||
| 2980 | |||||||||||||||||||||||||||||
| 2981 | package main; | ||||||||||||||||||||||||||||
| 2982 | |||||||||||||||||||||||||||||
| 2983 | use Venus::String; | ||||||||||||||||||||||||||||
| 2984 | |||||||||||||||||||||||||||||
| 2985 | my $string = Venus::String->new('name, age, dob, email'); | ||||||||||||||||||||||||||||
| 2986 | |||||||||||||||||||||||||||||
| 2987 | my $split = $string->split(', ', 2); | ||||||||||||||||||||||||||||
| 2988 | |||||||||||||||||||||||||||||
| 2989 | # ["name", "age, dob, email"] | ||||||||||||||||||||||||||||
| 2990 | |||||||||||||||||||||||||||||
| 2991 | =back | ||||||||||||||||||||||||||||
| 2992 | |||||||||||||||||||||||||||||
| 2993 | =over 4 | ||||||||||||||||||||||||||||
| 2994 | |||||||||||||||||||||||||||||
| 2995 | =item split example 3 | ||||||||||||||||||||||||||||
| 2996 | |||||||||||||||||||||||||||||
| 2997 | package main; | ||||||||||||||||||||||||||||
| 2998 | |||||||||||||||||||||||||||||
| 2999 | use Venus::String; | ||||||||||||||||||||||||||||
| 3000 | |||||||||||||||||||||||||||||
| 3001 | my $string = Venus::String->new('name, age, dob, email'); | ||||||||||||||||||||||||||||
| 3002 | |||||||||||||||||||||||||||||
| 3003 | my $split = $string->split(qr/\,\s*/); | ||||||||||||||||||||||||||||
| 3004 | |||||||||||||||||||||||||||||
| 3005 | # ["name", "age", "dob", "email"] | ||||||||||||||||||||||||||||
| 3006 | |||||||||||||||||||||||||||||
| 3007 | =back | ||||||||||||||||||||||||||||
| 3008 | |||||||||||||||||||||||||||||
| 3009 | =cut | ||||||||||||||||||||||||||||
| 3010 | |||||||||||||||||||||||||||||
| 3011 | =head2 stringified | ||||||||||||||||||||||||||||
| 3012 | |||||||||||||||||||||||||||||
| 3013 | stringified() (string) | ||||||||||||||||||||||||||||
| 3014 | |||||||||||||||||||||||||||||
| 3015 | The stringified method returns the object, stringified (i.e. a dump of the | ||||||||||||||||||||||||||||
| 3016 | object's value). | ||||||||||||||||||||||||||||
| 3017 | |||||||||||||||||||||||||||||
| 3018 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 3019 | |||||||||||||||||||||||||||||
| 3020 | =over 4 | ||||||||||||||||||||||||||||
| 3021 | |||||||||||||||||||||||||||||
| 3022 | =item stringified example 1 | ||||||||||||||||||||||||||||
| 3023 | |||||||||||||||||||||||||||||
| 3024 | # given: synopsis; | ||||||||||||||||||||||||||||
| 3025 | |||||||||||||||||||||||||||||
| 3026 | my $stringified = $string->stringified; | ||||||||||||||||||||||||||||
| 3027 | |||||||||||||||||||||||||||||
| 3028 | # "hello world" | ||||||||||||||||||||||||||||
| 3029 | |||||||||||||||||||||||||||||
| 3030 | =back | ||||||||||||||||||||||||||||
| 3031 | |||||||||||||||||||||||||||||
| 3032 | =over 4 | ||||||||||||||||||||||||||||
| 3033 | |||||||||||||||||||||||||||||
| 3034 | =item stringified example 2 | ||||||||||||||||||||||||||||
| 3035 | |||||||||||||||||||||||||||||
| 3036 | package main; | ||||||||||||||||||||||||||||
| 3037 | |||||||||||||||||||||||||||||
| 3038 | use Venus::String; | ||||||||||||||||||||||||||||
| 3039 | |||||||||||||||||||||||||||||
| 3040 | my $string = Venus::String->new("hello\nworld"); | ||||||||||||||||||||||||||||
| 3041 | |||||||||||||||||||||||||||||
| 3042 | my $stringified = $string->stringified; | ||||||||||||||||||||||||||||
| 3043 | |||||||||||||||||||||||||||||
| 3044 | # "hello\\nworld" | ||||||||||||||||||||||||||||
| 3045 | |||||||||||||||||||||||||||||
| 3046 | =back | ||||||||||||||||||||||||||||
| 3047 | |||||||||||||||||||||||||||||
| 3048 | =cut | ||||||||||||||||||||||||||||
| 3049 | |||||||||||||||||||||||||||||
| 3050 | =head2 strip | ||||||||||||||||||||||||||||
| 3051 | |||||||||||||||||||||||||||||
| 3052 | strip() (string) | ||||||||||||||||||||||||||||
| 3053 | |||||||||||||||||||||||||||||
| 3054 | The strip method returns the string replacing occurences of 2 or more | ||||||||||||||||||||||||||||
| 3055 | whitespaces with a single whitespace. | ||||||||||||||||||||||||||||
| 3056 | |||||||||||||||||||||||||||||
| 3057 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 3058 | |||||||||||||||||||||||||||||
| 3059 | =over 4 | ||||||||||||||||||||||||||||
| 3060 | |||||||||||||||||||||||||||||
| 3061 | =item strip example 1 | ||||||||||||||||||||||||||||
| 3062 | |||||||||||||||||||||||||||||
| 3063 | package main; | ||||||||||||||||||||||||||||
| 3064 | |||||||||||||||||||||||||||||
| 3065 | use Venus::String; | ||||||||||||||||||||||||||||
| 3066 | |||||||||||||||||||||||||||||
| 3067 | my $string = Venus::String->new('one, two, three'); | ||||||||||||||||||||||||||||
| 3068 | |||||||||||||||||||||||||||||
| 3069 | my $strip = $string->strip; | ||||||||||||||||||||||||||||
| 3070 | |||||||||||||||||||||||||||||
| 3071 | # "one, two, three" | ||||||||||||||||||||||||||||
| 3072 | |||||||||||||||||||||||||||||
| 3073 | =back | ||||||||||||||||||||||||||||
| 3074 | |||||||||||||||||||||||||||||
| 3075 | =cut | ||||||||||||||||||||||||||||
| 3076 | |||||||||||||||||||||||||||||
| 3077 | =head2 substr | ||||||||||||||||||||||||||||
| 3078 | |||||||||||||||||||||||||||||
| 3079 | substr(number $offset, number $length, string $replace) (string) | ||||||||||||||||||||||||||||
| 3080 | |||||||||||||||||||||||||||||
| 3081 | The substr method calls the core L</substr> function with the object's string | ||||||||||||||||||||||||||||
| 3082 | value. In list context returns the result and the subject. | ||||||||||||||||||||||||||||
| 3083 | |||||||||||||||||||||||||||||
| 3084 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 3085 | |||||||||||||||||||||||||||||
| 3086 | =over 4 | ||||||||||||||||||||||||||||
| 3087 | |||||||||||||||||||||||||||||
| 3088 | =item substr example 1 | ||||||||||||||||||||||||||||
| 3089 | |||||||||||||||||||||||||||||
| 3090 | package main; | ||||||||||||||||||||||||||||
| 3091 | |||||||||||||||||||||||||||||
| 3092 | use Venus::String; | ||||||||||||||||||||||||||||
| 3093 | |||||||||||||||||||||||||||||
| 3094 | my $string = Venus::String->new('hello world'); | ||||||||||||||||||||||||||||
| 3095 | |||||||||||||||||||||||||||||
| 3096 | my $substr = $string->substr(0, 5); | ||||||||||||||||||||||||||||
| 3097 | |||||||||||||||||||||||||||||
| 3098 | # "hello" | ||||||||||||||||||||||||||||
| 3099 | |||||||||||||||||||||||||||||
| 3100 | =back | ||||||||||||||||||||||||||||
| 3101 | |||||||||||||||||||||||||||||
| 3102 | =over 4 | ||||||||||||||||||||||||||||
| 3103 | |||||||||||||||||||||||||||||
| 3104 | =item substr example 2 | ||||||||||||||||||||||||||||
| 3105 | |||||||||||||||||||||||||||||
| 3106 | package main; | ||||||||||||||||||||||||||||
| 3107 | |||||||||||||||||||||||||||||
| 3108 | use Venus::String; | ||||||||||||||||||||||||||||
| 3109 | |||||||||||||||||||||||||||||
| 3110 | my $string = Venus::String->new('hello world'); | ||||||||||||||||||||||||||||
| 3111 | |||||||||||||||||||||||||||||
| 3112 | my $substr = $string->substr(6, 5); | ||||||||||||||||||||||||||||
| 3113 | |||||||||||||||||||||||||||||
| 3114 | # "world" | ||||||||||||||||||||||||||||
| 3115 | |||||||||||||||||||||||||||||
| 3116 | =back | ||||||||||||||||||||||||||||
| 3117 | |||||||||||||||||||||||||||||
| 3118 | =over 4 | ||||||||||||||||||||||||||||
| 3119 | |||||||||||||||||||||||||||||
| 3120 | =item substr example 3 | ||||||||||||||||||||||||||||
| 3121 | |||||||||||||||||||||||||||||
| 3122 | package main; | ||||||||||||||||||||||||||||
| 3123 | |||||||||||||||||||||||||||||
| 3124 | use Venus::String; | ||||||||||||||||||||||||||||
| 3125 | |||||||||||||||||||||||||||||
| 3126 | my $string = Venus::String->new('hello world'); | ||||||||||||||||||||||||||||
| 3127 | |||||||||||||||||||||||||||||
| 3128 | my $substr = $string->substr(6, 5, 'universe'); | ||||||||||||||||||||||||||||
| 3129 | |||||||||||||||||||||||||||||
| 3130 | # "hello universe" | ||||||||||||||||||||||||||||
| 3131 | |||||||||||||||||||||||||||||
| 3132 | =back | ||||||||||||||||||||||||||||
| 3133 | |||||||||||||||||||||||||||||
| 3134 | =over 4 | ||||||||||||||||||||||||||||
| 3135 | |||||||||||||||||||||||||||||
| 3136 | =item substr example 4 | ||||||||||||||||||||||||||||
| 3137 | |||||||||||||||||||||||||||||
| 3138 | package main; | ||||||||||||||||||||||||||||
| 3139 | |||||||||||||||||||||||||||||
| 3140 | use Venus::String; | ||||||||||||||||||||||||||||
| 3141 | |||||||||||||||||||||||||||||
| 3142 | my $string = Venus::String->new('hello world'); | ||||||||||||||||||||||||||||
| 3143 | |||||||||||||||||||||||||||||
| 3144 | my ($result, $subject) = $string->substr(6, 5, 'universe'); | ||||||||||||||||||||||||||||
| 3145 | |||||||||||||||||||||||||||||
| 3146 | # ("world", "hello universe") | ||||||||||||||||||||||||||||
| 3147 | |||||||||||||||||||||||||||||
| 3148 | =back | ||||||||||||||||||||||||||||
| 3149 | |||||||||||||||||||||||||||||
| 3150 | =cut | ||||||||||||||||||||||||||||
| 3151 | |||||||||||||||||||||||||||||
| 3152 | =head2 template | ||||||||||||||||||||||||||||
| 3153 | |||||||||||||||||||||||||||||
| 3154 | template(string | coderef $code, any @args) (any) | ||||||||||||||||||||||||||||
| 3155 | |||||||||||||||||||||||||||||
| 3156 | The template method uses the underlying string value to build and return a | ||||||||||||||||||||||||||||
| 3157 | L<Venus::Template> object, or dispatches to the coderef or method provided. | ||||||||||||||||||||||||||||
| 3158 | |||||||||||||||||||||||||||||
| 3159 | I<Since C<3.04>> | ||||||||||||||||||||||||||||
| 3160 | |||||||||||||||||||||||||||||
| 3161 | =over 4 | ||||||||||||||||||||||||||||
| 3162 | |||||||||||||||||||||||||||||
| 3163 | =item template example 1 | ||||||||||||||||||||||||||||
| 3164 | |||||||||||||||||||||||||||||
| 3165 | package main; | ||||||||||||||||||||||||||||
| 3166 | |||||||||||||||||||||||||||||
| 3167 | use Venus::String; | ||||||||||||||||||||||||||||
| 3168 | |||||||||||||||||||||||||||||
| 3169 | my $string = Venus::String->new('hello {{name}}'); | ||||||||||||||||||||||||||||
| 3170 | |||||||||||||||||||||||||||||
| 3171 | my $template = $string->template; | ||||||||||||||||||||||||||||
| 3172 | |||||||||||||||||||||||||||||
| 3173 | # bless({...}, "Venus::Template") | ||||||||||||||||||||||||||||
| 3174 | |||||||||||||||||||||||||||||
| 3175 | =back | ||||||||||||||||||||||||||||
| 3176 | |||||||||||||||||||||||||||||
| 3177 | =over 4 | ||||||||||||||||||||||||||||
| 3178 | |||||||||||||||||||||||||||||
| 3179 | =item template example 2 | ||||||||||||||||||||||||||||
| 3180 | |||||||||||||||||||||||||||||
| 3181 | package main; | ||||||||||||||||||||||||||||
| 3182 | |||||||||||||||||||||||||||||
| 3183 | use Venus::String; | ||||||||||||||||||||||||||||
| 3184 | |||||||||||||||||||||||||||||
| 3185 | my $string = Venus::String->new('hello {{name}}'); | ||||||||||||||||||||||||||||
| 3186 | |||||||||||||||||||||||||||||
| 3187 | my $template = $string->template('render', undef, { | ||||||||||||||||||||||||||||
| 3188 | name => 'user', | ||||||||||||||||||||||||||||
| 3189 | }); | ||||||||||||||||||||||||||||
| 3190 | |||||||||||||||||||||||||||||
| 3191 | # "hello user" | ||||||||||||||||||||||||||||
| 3192 | |||||||||||||||||||||||||||||
| 3193 | =back | ||||||||||||||||||||||||||||
| 3194 | |||||||||||||||||||||||||||||
| 3195 | =cut | ||||||||||||||||||||||||||||
| 3196 | |||||||||||||||||||||||||||||
| 3197 | =head2 titlecase | ||||||||||||||||||||||||||||
| 3198 | |||||||||||||||||||||||||||||
| 3199 | titlecase() (string) | ||||||||||||||||||||||||||||
| 3200 | |||||||||||||||||||||||||||||
| 3201 | The titlecase method returns the string capitalizing the first character of | ||||||||||||||||||||||||||||
| 3202 | each word. | ||||||||||||||||||||||||||||
| 3203 | |||||||||||||||||||||||||||||
| 3204 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 3205 | |||||||||||||||||||||||||||||
| 3206 | =over 4 | ||||||||||||||||||||||||||||
| 3207 | |||||||||||||||||||||||||||||
| 3208 | =item titlecase example 1 | ||||||||||||||||||||||||||||
| 3209 | |||||||||||||||||||||||||||||
| 3210 | # given: synopsis; | ||||||||||||||||||||||||||||
| 3211 | |||||||||||||||||||||||||||||
| 3212 | my $titlecase = $string->titlecase; | ||||||||||||||||||||||||||||
| 3213 | |||||||||||||||||||||||||||||
| 3214 | # "Hello World" | ||||||||||||||||||||||||||||
| 3215 | |||||||||||||||||||||||||||||
| 3216 | =back | ||||||||||||||||||||||||||||
| 3217 | |||||||||||||||||||||||||||||
| 3218 | =cut | ||||||||||||||||||||||||||||
| 3219 | |||||||||||||||||||||||||||||
| 3220 | =head2 trim | ||||||||||||||||||||||||||||
| 3221 | |||||||||||||||||||||||||||||
| 3222 | trim() (string) | ||||||||||||||||||||||||||||
| 3223 | |||||||||||||||||||||||||||||
| 3224 | The trim method removes one or more consecutive leading and/or trailing spaces | ||||||||||||||||||||||||||||
| 3225 | from the string. | ||||||||||||||||||||||||||||
| 3226 | |||||||||||||||||||||||||||||
| 3227 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 3228 | |||||||||||||||||||||||||||||
| 3229 | =over 4 | ||||||||||||||||||||||||||||
| 3230 | |||||||||||||||||||||||||||||
| 3231 | =item trim example 1 | ||||||||||||||||||||||||||||
| 3232 | |||||||||||||||||||||||||||||
| 3233 | package main; | ||||||||||||||||||||||||||||
| 3234 | |||||||||||||||||||||||||||||
| 3235 | use Venus::String; | ||||||||||||||||||||||||||||
| 3236 | |||||||||||||||||||||||||||||
| 3237 | my $string = Venus::String->new(' system is ready '); | ||||||||||||||||||||||||||||
| 3238 | |||||||||||||||||||||||||||||
| 3239 | my $trim = $string->trim; | ||||||||||||||||||||||||||||
| 3240 | |||||||||||||||||||||||||||||
| 3241 | # "system is ready" | ||||||||||||||||||||||||||||
| 3242 | |||||||||||||||||||||||||||||
| 3243 | =back | ||||||||||||||||||||||||||||
| 3244 | |||||||||||||||||||||||||||||
| 3245 | =cut | ||||||||||||||||||||||||||||
| 3246 | |||||||||||||||||||||||||||||
| 3247 | =head2 tv | ||||||||||||||||||||||||||||
| 3248 | |||||||||||||||||||||||||||||
| 3249 | tv(any $arg) (boolean) | ||||||||||||||||||||||||||||
| 3250 | |||||||||||||||||||||||||||||
| 3251 | The tv method performs a I<"type-and-value-equal-to"> operation using argument | ||||||||||||||||||||||||||||
| 3252 | provided. | ||||||||||||||||||||||||||||
| 3253 | |||||||||||||||||||||||||||||
| 3254 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 3255 | |||||||||||||||||||||||||||||
| 3256 | =over 4 | ||||||||||||||||||||||||||||
| 3257 | |||||||||||||||||||||||||||||
| 3258 | =item tv example 1 | ||||||||||||||||||||||||||||
| 3259 | |||||||||||||||||||||||||||||
| 3260 | package main; | ||||||||||||||||||||||||||||
| 3261 | |||||||||||||||||||||||||||||
| 3262 | use Venus::Array; | ||||||||||||||||||||||||||||
| 3263 | use Venus::String; | ||||||||||||||||||||||||||||
| 3264 | |||||||||||||||||||||||||||||
| 3265 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 3266 | my $rvalue = Venus::Array->new; | ||||||||||||||||||||||||||||
| 3267 | |||||||||||||||||||||||||||||
| 3268 | my $result = $lvalue->tv($rvalue); | ||||||||||||||||||||||||||||
| 3269 | |||||||||||||||||||||||||||||
| 3270 | # 0 | ||||||||||||||||||||||||||||
| 3271 | |||||||||||||||||||||||||||||
| 3272 | =back | ||||||||||||||||||||||||||||
| 3273 | |||||||||||||||||||||||||||||
| 3274 | =over 4 | ||||||||||||||||||||||||||||
| 3275 | |||||||||||||||||||||||||||||
| 3276 | =item tv example 2 | ||||||||||||||||||||||||||||
| 3277 | |||||||||||||||||||||||||||||
| 3278 | package main; | ||||||||||||||||||||||||||||
| 3279 | |||||||||||||||||||||||||||||
| 3280 | use Venus::Code; | ||||||||||||||||||||||||||||
| 3281 | use Venus::String; | ||||||||||||||||||||||||||||
| 3282 | |||||||||||||||||||||||||||||
| 3283 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 3284 | my $rvalue = Venus::Code->new; | ||||||||||||||||||||||||||||
| 3285 | |||||||||||||||||||||||||||||
| 3286 | my $result = $lvalue->tv($rvalue); | ||||||||||||||||||||||||||||
| 3287 | |||||||||||||||||||||||||||||
| 3288 | # 0 | ||||||||||||||||||||||||||||
| 3289 | |||||||||||||||||||||||||||||
| 3290 | =back | ||||||||||||||||||||||||||||
| 3291 | |||||||||||||||||||||||||||||
| 3292 | =over 4 | ||||||||||||||||||||||||||||
| 3293 | |||||||||||||||||||||||||||||
| 3294 | =item tv example 3 | ||||||||||||||||||||||||||||
| 3295 | |||||||||||||||||||||||||||||
| 3296 | package main; | ||||||||||||||||||||||||||||
| 3297 | |||||||||||||||||||||||||||||
| 3298 | use Venus::Float; | ||||||||||||||||||||||||||||
| 3299 | use Venus::String; | ||||||||||||||||||||||||||||
| 3300 | |||||||||||||||||||||||||||||
| 3301 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 3302 | my $rvalue = Venus::Float->new; | ||||||||||||||||||||||||||||
| 3303 | |||||||||||||||||||||||||||||
| 3304 | my $result = $lvalue->tv($rvalue); | ||||||||||||||||||||||||||||
| 3305 | |||||||||||||||||||||||||||||
| 3306 | # 0 | ||||||||||||||||||||||||||||
| 3307 | |||||||||||||||||||||||||||||
| 3308 | =back | ||||||||||||||||||||||||||||
| 3309 | |||||||||||||||||||||||||||||
| 3310 | =over 4 | ||||||||||||||||||||||||||||
| 3311 | |||||||||||||||||||||||||||||
| 3312 | =item tv example 4 | ||||||||||||||||||||||||||||
| 3313 | |||||||||||||||||||||||||||||
| 3314 | package main; | ||||||||||||||||||||||||||||
| 3315 | |||||||||||||||||||||||||||||
| 3316 | use Venus::Hash; | ||||||||||||||||||||||||||||
| 3317 | use Venus::String; | ||||||||||||||||||||||||||||
| 3318 | |||||||||||||||||||||||||||||
| 3319 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 3320 | my $rvalue = Venus::Hash->new; | ||||||||||||||||||||||||||||
| 3321 | |||||||||||||||||||||||||||||
| 3322 | my $result = $lvalue->tv($rvalue); | ||||||||||||||||||||||||||||
| 3323 | |||||||||||||||||||||||||||||
| 3324 | # 0 | ||||||||||||||||||||||||||||
| 3325 | |||||||||||||||||||||||||||||
| 3326 | =back | ||||||||||||||||||||||||||||
| 3327 | |||||||||||||||||||||||||||||
| 3328 | =over 4 | ||||||||||||||||||||||||||||
| 3329 | |||||||||||||||||||||||||||||
| 3330 | =item tv example 5 | ||||||||||||||||||||||||||||
| 3331 | |||||||||||||||||||||||||||||
| 3332 | package main; | ||||||||||||||||||||||||||||
| 3333 | |||||||||||||||||||||||||||||
| 3334 | use Venus::Number; | ||||||||||||||||||||||||||||
| 3335 | use Venus::String; | ||||||||||||||||||||||||||||
| 3336 | |||||||||||||||||||||||||||||
| 3337 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 3338 | my $rvalue = Venus::Number->new; | ||||||||||||||||||||||||||||
| 3339 | |||||||||||||||||||||||||||||
| 3340 | my $result = $lvalue->tv($rvalue); | ||||||||||||||||||||||||||||
| 3341 | |||||||||||||||||||||||||||||
| 3342 | # 0 | ||||||||||||||||||||||||||||
| 3343 | |||||||||||||||||||||||||||||
| 3344 | =back | ||||||||||||||||||||||||||||
| 3345 | |||||||||||||||||||||||||||||
| 3346 | =over 4 | ||||||||||||||||||||||||||||
| 3347 | |||||||||||||||||||||||||||||
| 3348 | =item tv example 6 | ||||||||||||||||||||||||||||
| 3349 | |||||||||||||||||||||||||||||
| 3350 | package main; | ||||||||||||||||||||||||||||
| 3351 | |||||||||||||||||||||||||||||
| 3352 | use Venus::Regexp; | ||||||||||||||||||||||||||||
| 3353 | use Venus::String; | ||||||||||||||||||||||||||||
| 3354 | |||||||||||||||||||||||||||||
| 3355 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 3356 | my $rvalue = Venus::Regexp->new; | ||||||||||||||||||||||||||||
| 3357 | |||||||||||||||||||||||||||||
| 3358 | my $result = $lvalue->tv($rvalue); | ||||||||||||||||||||||||||||
| 3359 | |||||||||||||||||||||||||||||
| 3360 | # 0 | ||||||||||||||||||||||||||||
| 3361 | |||||||||||||||||||||||||||||
| 3362 | =back | ||||||||||||||||||||||||||||
| 3363 | |||||||||||||||||||||||||||||
| 3364 | =over 4 | ||||||||||||||||||||||||||||
| 3365 | |||||||||||||||||||||||||||||
| 3366 | =item tv example 7 | ||||||||||||||||||||||||||||
| 3367 | |||||||||||||||||||||||||||||
| 3368 | package main; | ||||||||||||||||||||||||||||
| 3369 | |||||||||||||||||||||||||||||
| 3370 | use Venus::Scalar; | ||||||||||||||||||||||||||||
| 3371 | use Venus::String; | ||||||||||||||||||||||||||||
| 3372 | |||||||||||||||||||||||||||||
| 3373 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 3374 | my $rvalue = Venus::Scalar->new; | ||||||||||||||||||||||||||||
| 3375 | |||||||||||||||||||||||||||||
| 3376 | my $result = $lvalue->tv($rvalue); | ||||||||||||||||||||||||||||
| 3377 | |||||||||||||||||||||||||||||
| 3378 | # 0 | ||||||||||||||||||||||||||||
| 3379 | |||||||||||||||||||||||||||||
| 3380 | =back | ||||||||||||||||||||||||||||
| 3381 | |||||||||||||||||||||||||||||
| 3382 | =over 4 | ||||||||||||||||||||||||||||
| 3383 | |||||||||||||||||||||||||||||
| 3384 | =item tv example 8 | ||||||||||||||||||||||||||||
| 3385 | |||||||||||||||||||||||||||||
| 3386 | package main; | ||||||||||||||||||||||||||||
| 3387 | |||||||||||||||||||||||||||||
| 3388 | use Venus::String; | ||||||||||||||||||||||||||||
| 3389 | |||||||||||||||||||||||||||||
| 3390 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 3391 | my $rvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 3392 | |||||||||||||||||||||||||||||
| 3393 | my $result = $lvalue->tv($rvalue); | ||||||||||||||||||||||||||||
| 3394 | |||||||||||||||||||||||||||||
| 3395 | # 1 | ||||||||||||||||||||||||||||
| 3396 | |||||||||||||||||||||||||||||
| 3397 | =back | ||||||||||||||||||||||||||||
| 3398 | |||||||||||||||||||||||||||||
| 3399 | =over 4 | ||||||||||||||||||||||||||||
| 3400 | |||||||||||||||||||||||||||||
| 3401 | =item tv example 9 | ||||||||||||||||||||||||||||
| 3402 | |||||||||||||||||||||||||||||
| 3403 | package main; | ||||||||||||||||||||||||||||
| 3404 | |||||||||||||||||||||||||||||
| 3405 | use Venus::String; | ||||||||||||||||||||||||||||
| 3406 | use Venus::Undef; | ||||||||||||||||||||||||||||
| 3407 | |||||||||||||||||||||||||||||
| 3408 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 3409 | my $rvalue = Venus::Undef->new; | ||||||||||||||||||||||||||||
| 3410 | |||||||||||||||||||||||||||||
| 3411 | my $result = $lvalue->tv($rvalue); | ||||||||||||||||||||||||||||
| 3412 | |||||||||||||||||||||||||||||
| 3413 | # 0 | ||||||||||||||||||||||||||||
| 3414 | |||||||||||||||||||||||||||||
| 3415 | =back | ||||||||||||||||||||||||||||
| 3416 | |||||||||||||||||||||||||||||
| 3417 | =cut | ||||||||||||||||||||||||||||
| 3418 | |||||||||||||||||||||||||||||
| 3419 | =head2 uc | ||||||||||||||||||||||||||||
| 3420 | |||||||||||||||||||||||||||||
| 3421 | uc() (string) | ||||||||||||||||||||||||||||
| 3422 | |||||||||||||||||||||||||||||
| 3423 | The uc method returns an uppercased version of the string. | ||||||||||||||||||||||||||||
| 3424 | |||||||||||||||||||||||||||||
| 3425 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 3426 | |||||||||||||||||||||||||||||
| 3427 | =over 4 | ||||||||||||||||||||||||||||
| 3428 | |||||||||||||||||||||||||||||
| 3429 | =item uc example 1 | ||||||||||||||||||||||||||||
| 3430 | |||||||||||||||||||||||||||||
| 3431 | # given: synopsis; | ||||||||||||||||||||||||||||
| 3432 | |||||||||||||||||||||||||||||
| 3433 | my $uc = $string->uc; | ||||||||||||||||||||||||||||
| 3434 | |||||||||||||||||||||||||||||
| 3435 | # "HELLO WORLD" | ||||||||||||||||||||||||||||
| 3436 | |||||||||||||||||||||||||||||
| 3437 | =back | ||||||||||||||||||||||||||||
| 3438 | |||||||||||||||||||||||||||||
| 3439 | =cut | ||||||||||||||||||||||||||||
| 3440 | |||||||||||||||||||||||||||||
| 3441 | =head2 ucfirst | ||||||||||||||||||||||||||||
| 3442 | |||||||||||||||||||||||||||||
| 3443 | ucfirst() (string) | ||||||||||||||||||||||||||||
| 3444 | |||||||||||||||||||||||||||||
| 3445 | The ucfirst method returns a the string with the first character uppercased. | ||||||||||||||||||||||||||||
| 3446 | |||||||||||||||||||||||||||||
| 3447 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 3448 | |||||||||||||||||||||||||||||
| 3449 | =over 4 | ||||||||||||||||||||||||||||
| 3450 | |||||||||||||||||||||||||||||
| 3451 | =item ucfirst example 1 | ||||||||||||||||||||||||||||
| 3452 | |||||||||||||||||||||||||||||
| 3453 | # given: synopsis; | ||||||||||||||||||||||||||||
| 3454 | |||||||||||||||||||||||||||||
| 3455 | my $ucfirst = $string->ucfirst; | ||||||||||||||||||||||||||||
| 3456 | |||||||||||||||||||||||||||||
| 3457 | # "Hello world" | ||||||||||||||||||||||||||||
| 3458 | |||||||||||||||||||||||||||||
| 3459 | =back | ||||||||||||||||||||||||||||
| 3460 | |||||||||||||||||||||||||||||
| 3461 | =cut | ||||||||||||||||||||||||||||
| 3462 | |||||||||||||||||||||||||||||
| 3463 | =head2 uppercase | ||||||||||||||||||||||||||||
| 3464 | |||||||||||||||||||||||||||||
| 3465 | uppercase() (string) | ||||||||||||||||||||||||||||
| 3466 | |||||||||||||||||||||||||||||
| 3467 | The uppercase method is an alias to the uc method. | ||||||||||||||||||||||||||||
| 3468 | |||||||||||||||||||||||||||||
| 3469 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 3470 | |||||||||||||||||||||||||||||
| 3471 | =over 4 | ||||||||||||||||||||||||||||
| 3472 | |||||||||||||||||||||||||||||
| 3473 | =item uppercase example 1 | ||||||||||||||||||||||||||||
| 3474 | |||||||||||||||||||||||||||||
| 3475 | # given: synopsis; | ||||||||||||||||||||||||||||
| 3476 | |||||||||||||||||||||||||||||
| 3477 | my $uppercase = $string->uppercase; | ||||||||||||||||||||||||||||
| 3478 | |||||||||||||||||||||||||||||
| 3479 | # "HELLO WORLD" | ||||||||||||||||||||||||||||
| 3480 | |||||||||||||||||||||||||||||
| 3481 | =back | ||||||||||||||||||||||||||||
| 3482 | |||||||||||||||||||||||||||||
| 3483 | =cut | ||||||||||||||||||||||||||||
| 3484 | |||||||||||||||||||||||||||||
| 3485 | =head2 words | ||||||||||||||||||||||||||||
| 3486 | |||||||||||||||||||||||||||||
| 3487 | words() (within[arrayref, string]) | ||||||||||||||||||||||||||||
| 3488 | |||||||||||||||||||||||||||||
| 3489 | The words method returns an arrayref by splitting on 1 or more consecutive | ||||||||||||||||||||||||||||
| 3490 | spaces. | ||||||||||||||||||||||||||||
| 3491 | |||||||||||||||||||||||||||||
| 3492 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 3493 | |||||||||||||||||||||||||||||
| 3494 | =over 4 | ||||||||||||||||||||||||||||
| 3495 | |||||||||||||||||||||||||||||
| 3496 | =item words example 1 | ||||||||||||||||||||||||||||
| 3497 | |||||||||||||||||||||||||||||
| 3498 | package main; | ||||||||||||||||||||||||||||
| 3499 | |||||||||||||||||||||||||||||
| 3500 | use Venus::String; | ||||||||||||||||||||||||||||
| 3501 | |||||||||||||||||||||||||||||
| 3502 | my $string = Venus::String->new( | ||||||||||||||||||||||||||||
| 3503 | 'is this a bug we\'re experiencing' | ||||||||||||||||||||||||||||
| 3504 | ); | ||||||||||||||||||||||||||||
| 3505 | |||||||||||||||||||||||||||||
| 3506 | my $words = $string->words; | ||||||||||||||||||||||||||||
| 3507 | |||||||||||||||||||||||||||||
| 3508 | # ["is", "this", "a", "bug", "we're", "experiencing"] | ||||||||||||||||||||||||||||
| 3509 | |||||||||||||||||||||||||||||
| 3510 | =back | ||||||||||||||||||||||||||||
| 3511 | |||||||||||||||||||||||||||||
| 3512 | =cut | ||||||||||||||||||||||||||||
| 3513 | |||||||||||||||||||||||||||||
| 3514 | =head2 wrap | ||||||||||||||||||||||||||||
| 3515 | |||||||||||||||||||||||||||||
| 3516 | wrap(number $length, number $indent) (string) | ||||||||||||||||||||||||||||
| 3517 | |||||||||||||||||||||||||||||
| 3518 | The wrap method takes a maximum character length for each line, and an optional | ||||||||||||||||||||||||||||
| 3519 | number of spaces to use for indentation (defaulting to C<0>) and returns the | ||||||||||||||||||||||||||||
| 3520 | text formatted as a string where each line wraps at the specified length and is | ||||||||||||||||||||||||||||
| 3521 | indented with the given number of spaces. The default lenght is C<80>. | ||||||||||||||||||||||||||||
| 3522 | |||||||||||||||||||||||||||||
| 3523 | I<Since C<4.15>> | ||||||||||||||||||||||||||||
| 3524 | |||||||||||||||||||||||||||||
| 3525 | =over 4 | ||||||||||||||||||||||||||||
| 3526 | |||||||||||||||||||||||||||||
| 3527 | =item wrap example 1 | ||||||||||||||||||||||||||||
| 3528 | |||||||||||||||||||||||||||||
| 3529 | package main; | ||||||||||||||||||||||||||||
| 3530 | |||||||||||||||||||||||||||||
| 3531 | use Venus::String; | ||||||||||||||||||||||||||||
| 3532 | |||||||||||||||||||||||||||||
| 3533 | my $string = Venus::String->new(join(' ', | ||||||||||||||||||||||||||||
| 3534 | 'This is an example of a long line of text that needs', | ||||||||||||||||||||||||||||
| 3535 | 'to be wrapped and formatted.' | ||||||||||||||||||||||||||||
| 3536 | )); | ||||||||||||||||||||||||||||
| 3537 | |||||||||||||||||||||||||||||
| 3538 | my $wrap = $string->wrap(40, 2); | ||||||||||||||||||||||||||||
| 3539 | |||||||||||||||||||||||||||||
| 3540 | # " This is an example of a long line of | ||||||||||||||||||||||||||||
| 3541 | # text that needs to be wrapped and | ||||||||||||||||||||||||||||
| 3542 | # formatted." | ||||||||||||||||||||||||||||
| 3543 | |||||||||||||||||||||||||||||
| 3544 | =back | ||||||||||||||||||||||||||||
| 3545 | |||||||||||||||||||||||||||||
| 3546 | =cut | ||||||||||||||||||||||||||||
| 3547 | |||||||||||||||||||||||||||||
| 3548 | =head1 OPERATORS | ||||||||||||||||||||||||||||
| 3549 | |||||||||||||||||||||||||||||
| 3550 | This package overloads the following operators: | ||||||||||||||||||||||||||||
| 3551 | |||||||||||||||||||||||||||||
| 3552 | =cut | ||||||||||||||||||||||||||||
| 3553 | |||||||||||||||||||||||||||||
| 3554 | =over 4 | ||||||||||||||||||||||||||||
| 3555 | |||||||||||||||||||||||||||||
| 3556 | =item operation: C<("")> | ||||||||||||||||||||||||||||
| 3557 | |||||||||||||||||||||||||||||
| 3558 | This package overloads the C<""> operator. | ||||||||||||||||||||||||||||
| 3559 | |||||||||||||||||||||||||||||
| 3560 | B<example 1> | ||||||||||||||||||||||||||||
| 3561 | |||||||||||||||||||||||||||||
| 3562 | # given: synopsis; | ||||||||||||||||||||||||||||
| 3563 | |||||||||||||||||||||||||||||
| 3564 | my $result = "$string"; | ||||||||||||||||||||||||||||
| 3565 | |||||||||||||||||||||||||||||
| 3566 | # "hello world" | ||||||||||||||||||||||||||||
| 3567 | |||||||||||||||||||||||||||||
| 3568 | B<example 2> | ||||||||||||||||||||||||||||
| 3569 | |||||||||||||||||||||||||||||
| 3570 | # given: synopsis; | ||||||||||||||||||||||||||||
| 3571 | |||||||||||||||||||||||||||||
| 3572 | my $result = "$string, $string"; | ||||||||||||||||||||||||||||
| 3573 | |||||||||||||||||||||||||||||
| 3574 | # "hello world, hello world" | ||||||||||||||||||||||||||||
| 3575 | |||||||||||||||||||||||||||||
| 3576 | =back | ||||||||||||||||||||||||||||
| 3577 | |||||||||||||||||||||||||||||
| 3578 | =over 4 | ||||||||||||||||||||||||||||
| 3579 | |||||||||||||||||||||||||||||
| 3580 | =item operation: C<(eq)> | ||||||||||||||||||||||||||||
| 3581 | |||||||||||||||||||||||||||||
| 3582 | This package overloads the C<eq> operator. | ||||||||||||||||||||||||||||
| 3583 | |||||||||||||||||||||||||||||
| 3584 | B<example 1> | ||||||||||||||||||||||||||||
| 3585 | |||||||||||||||||||||||||||||
| 3586 | # given: synopsis; | ||||||||||||||||||||||||||||
| 3587 | |||||||||||||||||||||||||||||
| 3588 | my $result = $string eq 'hello world'; | ||||||||||||||||||||||||||||
| 3589 | |||||||||||||||||||||||||||||
| 3590 | # 1 | ||||||||||||||||||||||||||||
| 3591 | |||||||||||||||||||||||||||||
| 3592 | B<example 2> | ||||||||||||||||||||||||||||
| 3593 | |||||||||||||||||||||||||||||
| 3594 | package main; | ||||||||||||||||||||||||||||
| 3595 | |||||||||||||||||||||||||||||
| 3596 | use Venus::String; | ||||||||||||||||||||||||||||
| 3597 | |||||||||||||||||||||||||||||
| 3598 | my $string1 = Venus::String->new('hello world'); | ||||||||||||||||||||||||||||
| 3599 | my $string2 = Venus::String->new('hello world'); | ||||||||||||||||||||||||||||
| 3600 | |||||||||||||||||||||||||||||
| 3601 | my $result = $string1 eq $string2; | ||||||||||||||||||||||||||||
| 3602 | |||||||||||||||||||||||||||||
| 3603 | # 1 | ||||||||||||||||||||||||||||
| 3604 | |||||||||||||||||||||||||||||
| 3605 | =back | ||||||||||||||||||||||||||||
| 3606 | |||||||||||||||||||||||||||||
| 3607 | =over 4 | ||||||||||||||||||||||||||||
| 3608 | |||||||||||||||||||||||||||||
| 3609 | =item operation: C<(ne)> | ||||||||||||||||||||||||||||
| 3610 | |||||||||||||||||||||||||||||
| 3611 | This package overloads the C<ne> operator. | ||||||||||||||||||||||||||||
| 3612 | |||||||||||||||||||||||||||||
| 3613 | B<example 1> | ||||||||||||||||||||||||||||
| 3614 | |||||||||||||||||||||||||||||
| 3615 | # given: synopsis; | ||||||||||||||||||||||||||||
| 3616 | |||||||||||||||||||||||||||||
| 3617 | my $result = $string ne 'Hello world'; | ||||||||||||||||||||||||||||
| 3618 | |||||||||||||||||||||||||||||
| 3619 | # 1 | ||||||||||||||||||||||||||||
| 3620 | |||||||||||||||||||||||||||||
| 3621 | B<example 2> | ||||||||||||||||||||||||||||
| 3622 | |||||||||||||||||||||||||||||
| 3623 | package main; | ||||||||||||||||||||||||||||
| 3624 | |||||||||||||||||||||||||||||
| 3625 | use Venus::String; | ||||||||||||||||||||||||||||
| 3626 | |||||||||||||||||||||||||||||
| 3627 | my $string1 = Venus::String->new('hello world'); | ||||||||||||||||||||||||||||
| 3628 | my $string2 = Venus::String->new('Hello world'); | ||||||||||||||||||||||||||||
| 3629 | |||||||||||||||||||||||||||||
| 3630 | my $result = $string1 ne $string2; | ||||||||||||||||||||||||||||
| 3631 | |||||||||||||||||||||||||||||
| 3632 | # 1 | ||||||||||||||||||||||||||||
| 3633 | |||||||||||||||||||||||||||||
| 3634 | =back | ||||||||||||||||||||||||||||
| 3635 | |||||||||||||||||||||||||||||
| 3636 | =over 4 | ||||||||||||||||||||||||||||
| 3637 | |||||||||||||||||||||||||||||
| 3638 | =item operation: C<(qr)> | ||||||||||||||||||||||||||||
| 3639 | |||||||||||||||||||||||||||||
| 3640 | This package overloads the C<qr> operator. | ||||||||||||||||||||||||||||
| 3641 | |||||||||||||||||||||||||||||
| 3642 | B<example 1> | ||||||||||||||||||||||||||||
| 3643 | |||||||||||||||||||||||||||||
| 3644 | # given: synopsis; | ||||||||||||||||||||||||||||
| 3645 | |||||||||||||||||||||||||||||
| 3646 | my $test = 'hello world' =~ qr/$string/; | ||||||||||||||||||||||||||||
| 3647 | |||||||||||||||||||||||||||||
| 3648 | # 1 | ||||||||||||||||||||||||||||
| 3649 | |||||||||||||||||||||||||||||
| 3650 | =back | ||||||||||||||||||||||||||||
| 3651 | |||||||||||||||||||||||||||||
| 3652 | =head1 AUTHORS | ||||||||||||||||||||||||||||
| 3653 | |||||||||||||||||||||||||||||
| 3654 | Awncorp, C<awncorp@cpan.org> | ||||||||||||||||||||||||||||
| 3655 | |||||||||||||||||||||||||||||
| 3656 | =cut | ||||||||||||||||||||||||||||
| 3657 | |||||||||||||||||||||||||||||
| 3658 | =head1 LICENSE | ||||||||||||||||||||||||||||
| 3659 | |||||||||||||||||||||||||||||
| 3660 | Copyright (C) 2022, Awncorp, C<awncorp@cpan.org>. | ||||||||||||||||||||||||||||
| 3661 | |||||||||||||||||||||||||||||
| 3662 | This program is free software, you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 3663 | the terms of the Apache license version 2.0. | ||||||||||||||||||||||||||||
| 3664 | |||||||||||||||||||||||||||||
| 3665 | =cut | ||||||||||||||||||||||||||||