| 1 | package Venus::String; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 20 | ▶ | use 5.018; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 20 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 20 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 20 | ▶ | use Venus::Class 'base'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 20 | base 'Venus::Kind::Value'; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | use overload ( | ||||||||||||||||||||||||||||
| 13 | 23 | ▶ | 'eq' => sub{$_[0]->value eq "$_[1]"}, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 2 | ▶ | 'ne' => sub{$_[0]->value ne "$_[1]"}, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 1 | ▶ | 'qr' => sub{qr/@{[quotemeta($_[0]->value)]}/}, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 20 | fallback => 1, | |||||||||||||||||||||||||||
| 17 | 20 | ▶ | ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | # METHODS | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | sub append { | ||||||||||||||||||||||||||||
| 22 | 1 | ▶ | my ($self, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
append: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 1 | return $self->append_with(' ', @args); | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | sub append_with { | ||||||||||||||||||||||||||||
| 28 | 2 | ▶ | my ($self, $delimiter, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
append_with: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 2 | my $data = $self->get; | |||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 2 | ▶ | return CORE::join($delimiter // '', $data, @args); | ||||||||||||||||||||||||||
|
Condition50%1/2
$delimiter // ""
MC/DC0%0/1
$delimiter // ""
$delimiter
Truth table50%1/2
A
A= $delimiter
| |||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | sub assertion { | ||||||||||||||||||||||||||||
| 36 | 44 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
assertion: called CC=1 SCAR=2.0
Pod
documented
| |||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 44 | my $assertion = $self->SUPER::assertion; | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | $assertion->match('bool')->format(sub{ | ||||||||||||||||||||||||||||
| 41 | 0 | ▶ | (ref $self || $self)->new($_) | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Condition0%0/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table0%0/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||||||||||
| 42 | 44 | }); | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | $assertion->match('float')->format(sub{ | ||||||||||||||||||||||||||||
| 45 | 0 | ▶ | (ref $self || $self)->new($_) | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Condition0%0/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table0%0/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||||||||||
| 46 | 44 | }); | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | $assertion->match('number')->format(sub{ | ||||||||||||||||||||||||||||
| 49 | 0 | ▶ | (ref $self || $self)->new($_) | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Condition0%0/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table0%0/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||||||||||
| 50 | 44 | }); | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | $assertion->match('string')->format(sub{ | ||||||||||||||||||||||||||||
| 53 | 44 | ▶ | (ref $self || $self)->new($_) | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=9.2
Condition33%1/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table33%1/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||||||||||
| 54 | 44 | }); | |||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 44 | return $assertion; | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | sub camelcase { | ||||||||||||||||||||||||||||
| 60 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
camelcase: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 1 | my $result = CORE::ucfirst(CORE::lc($data)); | |||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 1 | $result =~ s/[^a-zA-Z0-9]+([a-z])/\U$1/g; | |||||||||||||||||||||||||||
| 67 | 1 | $result =~ s/[^a-zA-Z0-9]+//g; | |||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 1 | return CORE::lcfirst($result); | |||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | sub chomp { | ||||||||||||||||||||||||||||
| 73 | 2 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
chomp: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 2 | my $data = $self->get; | |||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 2 | CORE::chomp($data); | |||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 2 | return $data; | |||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | sub chop { | ||||||||||||||||||||||||||||
| 83 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
chop: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 1 | CORE::chop($data); | |||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 1 | return $data; | |||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | sub comparer { | ||||||||||||||||||||||||||||
| 93 | 270 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
comparer: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 270 | my $data = $self->get; | |||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 270 | require Scalar::Util; | |||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 270 | ▶ | return Scalar::Util::looks_like_number($data) ? 'numified' : 'stringified'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | sub concat { | ||||||||||||||||||||||||||||
| 103 | 1 | ▶ | my ($self, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
concat: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | 1 | return CORE::join('', $data, @args); | |||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | sub contains { | ||||||||||||||||||||||||||||
| 111 | 3 | ▶ | my ($self, $pattern) = @_; | ||||||||||||||||||||||||||
|
Subroutine
contains: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 3 | my $data = $self->get; | |||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | 3 | ▶ | return 0 unless CORE::defined($pattern); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | 3 | my $regexp = UNIVERSAL::isa($pattern, 'Regexp'); | |||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | 3 | ▶ | return CORE::index($data, $pattern) < 0 ? 0 : 1 if !$regexp; | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | 1 | ▶ | return ($data =~ $pattern) ? true : false; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | sub default { | ||||||||||||||||||||||||||||
| 125 | 182 | ▶ | return ''; | ||||||||||||||||||||||||||
|
Subroutine
default: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | sub format { | ||||||||||||||||||||||||||||
| 129 | 2 | ▶ | my ($self, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
format: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 2 | my $data = $self->get; | |||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | 2 | return CORE::sprintf($data, @args); | |||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | sub hex { | ||||||||||||||||||||||||||||
| 137 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
hex: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | 1 | return CORE::hex($data); | |||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | sub index { | ||||||||||||||||||||||||||||
| 145 | 3 | ▶ | my ($self, $substr, $start) = @_; | ||||||||||||||||||||||||||
|
Subroutine
index: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | 3 | my $data = $self->get; | |||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | 3 | ▶ | return CORE::index($data, $substr) if not(CORE::defined($start)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 150 | 1 | return CORE::index($data, $substr, $start); | |||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | sub kebabcase { | ||||||||||||||||||||||||||||
| 154 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
kebabcase: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 157 | 1 | my $re = qr/[\W_]+/; | |||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | 1 | $data =~ s/$re/-/g; | |||||||||||||||||||||||||||
| 160 | 1 | $data =~ s/^$re|$re$//g; | |||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | 1 | return $data; | |||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | sub lc { | ||||||||||||||||||||||||||||
| 166 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
lc: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | 1 | return CORE::lc($data); | |||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | sub lcfirst { | ||||||||||||||||||||||||||||
| 174 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
lcfirst: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | 1 | return CORE::lcfirst($data); | |||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | sub length { | ||||||||||||||||||||||||||||
| 182 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
length: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | 1 | return CORE::length($data); | |||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | sub lines { | ||||||||||||||||||||||||||||
| 190 | 2 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
lines: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | 2 | my $data = $self->get; | |||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | 2 | return [CORE::split(/[\n\r]+/, $data)]; | |||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | sub lowercase { | ||||||||||||||||||||||||||||
| 198 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
lowercase: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | 1 | return CORE::lc($data); | |||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | sub numified { | ||||||||||||||||||||||||||||
| 206 | 76 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
numified: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | 76 | my $data = $self->get; | |||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | 76 | ▶ | return $self->comparer eq 'numified' ? (0 + $data) : $self->SUPER::numified(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | sub pascalcase { | ||||||||||||||||||||||||||||
| 214 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
pascalcase: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | 1 | my $result = CORE::ucfirst(CORE::lc($data)); | |||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | 1 | $result =~ s/[^a-zA-Z0-9]+([a-z])/\U$1/g; | |||||||||||||||||||||||||||
| 221 | 1 | $result =~ s/[^a-zA-Z0-9]+//g; | |||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | 1 | return $result; | |||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | sub prepend { | ||||||||||||||||||||||||||||
| 227 | 1 | ▶ | my ($self, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
prepend: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | 1 | return $self->prepend_with(' ', @args); | |||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | sub prepend_with { | ||||||||||||||||||||||||||||
| 233 | 2 | ▶ | my ($self, $delimiter, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
prepend_with: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | 2 | my $data = $self->get; | |||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | 2 | ▶ | return CORE::join($delimiter // '', @args, $data); | ||||||||||||||||||||||||||
|
Condition50%1/2
$delimiter // ""
MC/DC0%0/1
$delimiter // ""
$delimiter
Truth table50%1/2
A
A= $delimiter
| |||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||
| 240 | sub repeat { | ||||||||||||||||||||||||||||
| 241 | 2 | ▶ | my ($self, $count, $delimiter) = @_; | ||||||||||||||||||||||||||
|
Subroutine
repeat: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | 2 | my $data = $self->get; | |||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | 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
| |||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | sub render { | ||||||||||||||||||||||||||||
| 249 | 1 | ▶ | my ($self, $tokens) = @_; | ||||||||||||||||||||||||||
|
Subroutine
render: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | 1 | ▶ | $tokens ||= {}; | ||||||||||||||||||||||||||
|
Condition50%1/2
$tokens ||= {}
MC/DC0%0/1
$tokens ||= {}
$tokens
Truth table50%1/2
A
A= $tokens
| |||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | 1 | ▶ | while (my($key, $value) = each(%$tokens)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 256 | 1 | my $token = quotemeta $key; | |||||||||||||||||||||||||||
| 257 | 1 | $data =~ s/\{\{\s*$token\s*\}\}/$value/g; | |||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | 1 | return $data; | |||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | sub replace { | ||||||||||||||||||||||||||||
| 264 | 1 | ▶ | my ($self, $regexp, $replace, $flags) = @_; | ||||||||||||||||||||||||||
|
Subroutine
replace: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | 1 | require Venus::Regexp; | |||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | 1 | return Venus::Regexp->new($regexp)->replace($self->get, $replace, $flags); | |||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | sub reverse { | ||||||||||||||||||||||||||||
| 272 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
reverse: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | 1 | return scalar(CORE::reverse($data)); | |||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | sub rindex { | ||||||||||||||||||||||||||||
| 280 | 3 | ▶ | my ($self, $substr, $start) = @_; | ||||||||||||||||||||||||||
|
Subroutine
rindex: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | 3 | my $data = $self->get; | |||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | 3 | ▶ | return CORE::rindex($data, $substr) if not(CORE::defined($start)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 285 | 1 | return CORE::rindex($data, $substr, $start); | |||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | sub search { | ||||||||||||||||||||||||||||
| 289 | 1 | ▶ | my ($self, $regexp) = @_; | ||||||||||||||||||||||||||
|
Subroutine
search: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | 1 | require Venus::Regexp; | |||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | 1 | return Venus::Regexp->new($regexp)->search($self->get); | |||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | sub snakecase { | ||||||||||||||||||||||||||||
| 297 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
snakecase: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 300 | 1 | my $re = qr/[\W_]+/; | |||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | 1 | $data =~ s/$re/_/g; | |||||||||||||||||||||||||||
| 303 | 1 | $data =~ s/^$re|$re$//g; | |||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | 1 | return $data; | |||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | sub split { | ||||||||||||||||||||||||||||
| 309 | 3 | ▶ | my ($self, $pattern, $limit) = @_; | ||||||||||||||||||||||||||
|
Subroutine
split: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | 3 | my $data = $self->get; | |||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | 3 | ▶ | $pattern //= ''; | ||||||||||||||||||||||||||
|
Condition50%1/2
$pattern //= ""
MC/DC0%0/1
$pattern //= ""
$pattern
Truth table50%1/2
A
A= $pattern
| |||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | 3 | my $regexp = UNIVERSAL::isa($pattern, 'Regexp'); | |||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | 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
| |||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | 3 | ▶ | return [CORE::split(/$pattern/, $data)] if !CORE::defined($limit); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 320 | 1 | return [CORE::split(/$pattern/, $data, $limit)]; | |||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | sub strip { | ||||||||||||||||||||||||||||
| 324 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
strip: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | 1 | $data =~ s/\s{2,}/ /g; | |||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | 1 | return $data; | |||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||
| 333 | sub substr { | ||||||||||||||||||||||||||||
| 334 | 4 | ▶ | my ($self, $offset, $length, $replace) = @_; | ||||||||||||||||||||||||||
|
Subroutine
substr: called CC=8 SCAR=21.8
Pod
documented
| |||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | 4 | my $data = $self->get; | |||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||
| 338 | 4 | ▶ | if (CORE::defined($replace)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 339 | 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
| |||||||||||||||||||||||||||||
| 340 | 2 | ▶ | return wantarray ? ($result, $data) : $data; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||
| 342 | else { | ||||||||||||||||||||||||||||
| 343 | 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
| |||||||||||||||||||||||||||||
| 344 | 2 | ▶ | return wantarray ? ($result, $data) : $result; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||
| 348 | sub template { | ||||||||||||||||||||||||||||
| 349 | 2 | ▶ | my ($self, $code, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
template: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||
| 351 | 2 | require Venus::Template; | |||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||
| 353 | 2 | my $template = Venus::Template->new($self->get); | |||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||
| 355 | 2 | ▶ | return $code ? $template->$code(@args) : $template; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | sub titlecase { | ||||||||||||||||||||||||||||
| 359 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
titlecase: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||
| 361 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||
| 363 | 1 | $data =~ s/\b(\w)/\U$1/g; | |||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | 1 | return $data; | |||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | sub trim { | ||||||||||||||||||||||||||||
| 369 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
trim: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||
| 371 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||
| 373 | 1 | $data =~ s/^\s+|\s+$//g; | |||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||
| 375 | 1 | return $data; | |||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||
| 378 | sub uc { | ||||||||||||||||||||||||||||
| 379 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
uc: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||
| 381 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||
| 383 | 1 | return CORE::uc($data); | |||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||
| 386 | sub ucfirst { | ||||||||||||||||||||||||||||
| 387 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
ucfirst: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||
| 389 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | 1 | return CORE::ucfirst($data); | |||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||
| 394 | sub uppercase { | ||||||||||||||||||||||||||||
| 395 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
uppercase: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||
| 397 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||
| 399 | 1 | return CORE::uc($data); | |||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||
| 402 | sub words { | ||||||||||||||||||||||||||||
| 403 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
words: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||
| 405 | 1 | my $data = $self->get; | |||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||
| 407 | 1 | return [CORE::split(/\s+/, $data)]; | |||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||
| 410 | 20 | 1; | |||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||
| 414 | =head1 NAME | ||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||
| 416 | Venus::String - String Class | ||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||
| 418 | =cut | ||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||
| 420 | =head1 ABSTRACT | ||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||
| 422 | String Class for Perl 5 | ||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||
| 424 | =cut | ||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||
| 426 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||
| 428 | package main; | ||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||
| 430 | use Venus::String; | ||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||
| 432 | my $string = Venus::String->new('hello world'); | ||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||
| 434 | # $string->camelcase; | ||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||
| 436 | =cut | ||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||
| 438 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||
| 440 | This package provides methods for manipulating string data. | ||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||
| 442 | =cut | ||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||
| 444 | =head1 INHERITS | ||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||
| 446 | This package inherits behaviors from: | ||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||
| 448 | L<Venus::Kind::Value> | ||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||
| 450 | =cut | ||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||
| 452 | =head1 METHODS | ||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||
| 454 | This package provides the following methods: | ||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||
| 456 | =cut | ||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||
| 458 | =head2 append | ||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||
| 460 | append(string @parts) (string) | ||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||
| 462 | The append method appends arugments to the string using spaces. | ||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||
| 464 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||
| 466 | =over 4 | ||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||
| 468 | =item append example 1 | ||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||
| 470 | # given: synopsis; | ||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||
| 472 | my $append = $string->append('welcome'); | ||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||
| 474 | # "hello world welcome" | ||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||
| 476 | =back | ||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||
| 478 | =cut | ||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||
| 480 | =head2 append_with | ||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||
| 482 | append_with(string $delimiter, string @parts) (string) | ||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||
| 484 | The append_with method appends arugments to the string using the delimiter | ||||||||||||||||||||||||||||
| 485 | provided. | ||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||
| 487 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||
| 489 | =over 4 | ||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||
| 491 | =item append_with example 1 | ||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||
| 493 | # given: synopsis; | ||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||
| 495 | my $append = $string->append_with(', ', 'welcome'); | ||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||
| 497 | # "hello world, welcome" | ||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||
| 499 | =back | ||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||
| 501 | =cut | ||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||
| 503 | =head2 camelcase | ||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||
| 505 | camelcase() (string) | ||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||
| 507 | The camelcase method converts the string to camelcase. | ||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||
| 509 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||
| 511 | =over 4 | ||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||
| 513 | =item camelcase example 1 | ||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||
| 515 | # given: synopsis; | ||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||
| 517 | my $camelcase = $string->camelcase; | ||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||
| 519 | # "helloWorld" | ||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||
| 521 | =back | ||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||
| 523 | =cut | ||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||
| 525 | =head2 cast | ||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||
| 527 | cast(string $kind) (object | undef) | ||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||
| 529 | The cast method converts L<"value"|Venus::Kind::Value> objects between | ||||||||||||||||||||||||||||
| 530 | different I<"value"> object types, based on the name of the type provided. This | ||||||||||||||||||||||||||||
| 531 | method will return C<undef> if the invocant is not a L<Venus::Kind::Value>. | ||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||
| 533 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||
| 535 | =over 4 | ||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||
| 537 | =item cast example 1 | ||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||
| 539 | package main; | ||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||
| 541 | use Venus::String; | ||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||
| 543 | my $string = Venus::String->new; | ||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||
| 545 | my $cast = $string->cast('array'); | ||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||
| 547 | # bless({ value => [""] }, "Venus::Array") | ||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||
| 549 | =back | ||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||
| 551 | =over 4 | ||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||
| 553 | =item cast example 2 | ||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||
| 555 | package main; | ||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||
| 557 | use Venus::String; | ||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||
| 559 | my $string = Venus::String->new; | ||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||
| 561 | my $cast = $string->cast('boolean'); | ||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||
| 563 | # bless({ value => 0 }, "Venus::Boolean") | ||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||
| 565 | =back | ||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||
| 567 | =over 4 | ||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||
| 569 | =item cast example 3 | ||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||
| 571 | package main; | ||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||
| 573 | use Venus::String; | ||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||
| 575 | my $string = Venus::String->new; | ||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||
| 577 | my $cast = $string->cast('code'); | ||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||
| 579 | # bless({ value => sub { ... } }, "Venus::Code") | ||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||
| 581 | =back | ||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||
| 583 | =over 4 | ||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||
| 585 | =item cast example 4 | ||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||
| 587 | package main; | ||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||
| 589 | use Venus::String; | ||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||
| 591 | my $string = Venus::String->new; | ||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||
| 593 | my $cast = $string->cast('float'); | ||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||
| 595 | # bless({ value => "0.0" }, "Venus::Float") | ||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||
| 597 | =back | ||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||
| 599 | =over 4 | ||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||
| 601 | =item cast example 5 | ||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||
| 603 | package main; | ||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||
| 605 | use Venus::String; | ||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||
| 607 | my $string = Venus::String->new; | ||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||
| 609 | my $cast = $string->cast('hash'); | ||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||
| 611 | # bless({ value => { "" => "" } }, "Venus::Hash") | ||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||
| 613 | =back | ||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||
| 615 | =over 4 | ||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||
| 617 | =item cast example 6 | ||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||
| 619 | package main; | ||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||
| 621 | use Venus::String; | ||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||
| 623 | my $string = Venus::String->new; | ||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||
| 625 | my $cast = $string->cast('number'); | ||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||
| 627 | # bless({ value => 0 }, "Venus::Float") | ||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||
| 629 | =back | ||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||
| 631 | =over 4 | ||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||
| 633 | =item cast example 7 | ||||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||
| 635 | package main; | ||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||
| 637 | use Venus::String; | ||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||
| 639 | my $string = Venus::String->new; | ||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||
| 641 | my $cast = $string->cast('regexp'); | ||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||
| 643 | # bless({ value => qr/(?^u:)/ }, "Venus::Regexp") | ||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||
| 645 | =back | ||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||
| 647 | =over 4 | ||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||
| 649 | =item cast example 8 | ||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||
| 651 | package main; | ||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||
| 653 | use Venus::String; | ||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||
| 655 | my $string = Venus::String->new; | ||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||
| 657 | my $cast = $string->cast('scalar'); | ||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||
| 659 | # bless({ value => \"" }, "Venus::Scalar") | ||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||
| 661 | =back | ||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||
| 663 | =over 4 | ||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||
| 665 | =item cast example 9 | ||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||
| 667 | package main; | ||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||
| 669 | use Venus::String; | ||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||
| 671 | my $string = Venus::String->new; | ||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||
| 673 | my $cast = $string->cast('string'); | ||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||
| 675 | # bless({ value => "" }, "Venus::String") | ||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||
| 677 | =back | ||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||
| 679 | =over 4 | ||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||
| 681 | =item cast example 10 | ||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||
| 683 | package main; | ||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||
| 685 | use Venus::String; | ||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||
| 687 | my $string = Venus::String->new; | ||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||
| 689 | my $cast = $string->cast('undef'); | ||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||
| 691 | # bless({ value => undef }, "Venus::Undef") | ||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||
| 693 | =back | ||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||
| 695 | =cut | ||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||
| 697 | =head2 chomp | ||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||
| 699 | chomp() (string) | ||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||
| 701 | The chomp method removes the newline (or the current value of $/) from the end | ||||||||||||||||||||||||||||
| 702 | of the string. | ||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||
| 704 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||
| 706 | =over 4 | ||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||
| 708 | =item chomp example 1 | ||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||
| 710 | package main; | ||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||
| 712 | use Venus::String; | ||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||
| 714 | my $string = Venus::String->new("name, age, dob, email\n"); | ||||||||||||||||||||||||||||
| 715 | |||||||||||||||||||||||||||||
| 716 | my $chomp = $string->chomp; | ||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||
| 718 | # "name, age, dob, email" | ||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||
| 720 | =back | ||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||
| 722 | =over 4 | ||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||
| 724 | =item chomp example 2 | ||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||
| 726 | package main; | ||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||
| 728 | use Venus::String; | ||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||
| 730 | my $string = Venus::String->new("name, age, dob, email\n\n"); | ||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||
| 732 | my $chomp = $string->chomp; | ||||||||||||||||||||||||||||
| 733 | |||||||||||||||||||||||||||||
| 734 | # "name, age, dob, email\n" | ||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||
| 736 | =back | ||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||
| 738 | =cut | ||||||||||||||||||||||||||||
| 739 | |||||||||||||||||||||||||||||
| 740 | =head2 chop | ||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||
| 742 | chop() (string) | ||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||
| 744 | The chop method removes and returns the last character of the string. | ||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||
| 746 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||
| 748 | =over 4 | ||||||||||||||||||||||||||||
| 749 | |||||||||||||||||||||||||||||
| 750 | =item chop example 1 | ||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||
| 752 | package main; | ||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||
| 754 | use Venus::String; | ||||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||||
| 756 | my $string = Venus::String->new("this is just a test."); | ||||||||||||||||||||||||||||
| 757 | |||||||||||||||||||||||||||||
| 758 | my $chop = $string->chop; | ||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||
| 760 | # "this is just a test" | ||||||||||||||||||||||||||||
| 761 | |||||||||||||||||||||||||||||
| 762 | =back | ||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||
| 764 | =cut | ||||||||||||||||||||||||||||
| 765 | |||||||||||||||||||||||||||||
| 766 | =head2 concat | ||||||||||||||||||||||||||||
| 767 | |||||||||||||||||||||||||||||
| 768 | concat(string @parts) (string) | ||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||
| 770 | The concat method returns the string with the argument list appended to it. | ||||||||||||||||||||||||||||
| 771 | |||||||||||||||||||||||||||||
| 772 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 773 | |||||||||||||||||||||||||||||
| 774 | =over 4 | ||||||||||||||||||||||||||||
| 775 | |||||||||||||||||||||||||||||
| 776 | =item concat example 1 | ||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||
| 778 | package main; | ||||||||||||||||||||||||||||
| 779 | |||||||||||||||||||||||||||||
| 780 | use Venus::String; | ||||||||||||||||||||||||||||
| 781 | |||||||||||||||||||||||||||||
| 782 | my $string = Venus::String->new('ABC'); | ||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||
| 784 | my $concat = $string->concat('DEF', 'GHI'); | ||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||
| 786 | # "ABCDEFGHI" | ||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||
| 788 | =back | ||||||||||||||||||||||||||||
| 789 | |||||||||||||||||||||||||||||
| 790 | =cut | ||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||
| 792 | =head2 contains | ||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||
| 794 | contains(string $expr) (boolean) | ||||||||||||||||||||||||||||
| 795 | |||||||||||||||||||||||||||||
| 796 | The contains method searches the string for a substring or expression returns | ||||||||||||||||||||||||||||
| 797 | true or false if found. | ||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||
| 799 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||
| 801 | =over 4 | ||||||||||||||||||||||||||||
| 802 | |||||||||||||||||||||||||||||
| 803 | =item contains example 1 | ||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||
| 805 | package main; | ||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||
| 807 | use Venus::String; | ||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||
| 809 | my $string = Venus::String->new('Nullam ultrices placerat.'); | ||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||
| 811 | my $contains = $string->contains('trices'); | ||||||||||||||||||||||||||||
| 812 | |||||||||||||||||||||||||||||
| 813 | # 1 | ||||||||||||||||||||||||||||
| 814 | |||||||||||||||||||||||||||||
| 815 | =back | ||||||||||||||||||||||||||||
| 816 | |||||||||||||||||||||||||||||
| 817 | =over 4 | ||||||||||||||||||||||||||||
| 818 | |||||||||||||||||||||||||||||
| 819 | =item contains example 2 | ||||||||||||||||||||||||||||
| 820 | |||||||||||||||||||||||||||||
| 821 | package main; | ||||||||||||||||||||||||||||
| 822 | |||||||||||||||||||||||||||||
| 823 | use Venus::String; | ||||||||||||||||||||||||||||
| 824 | |||||||||||||||||||||||||||||
| 825 | my $string = Venus::String->new('Nullam ultrices placerat.'); | ||||||||||||||||||||||||||||
| 826 | |||||||||||||||||||||||||||||
| 827 | my $contains = $string->contains('itrices'); | ||||||||||||||||||||||||||||
| 828 | |||||||||||||||||||||||||||||
| 829 | # 0 | ||||||||||||||||||||||||||||
| 830 | |||||||||||||||||||||||||||||
| 831 | =back | ||||||||||||||||||||||||||||
| 832 | |||||||||||||||||||||||||||||
| 833 | =over 4 | ||||||||||||||||||||||||||||
| 834 | |||||||||||||||||||||||||||||
| 835 | =item contains example 3 | ||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||
| 837 | package main; | ||||||||||||||||||||||||||||
| 838 | |||||||||||||||||||||||||||||
| 839 | use Venus::String; | ||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||
| 841 | my $string = Venus::String->new('Nullam ultrices placerat.'); | ||||||||||||||||||||||||||||
| 842 | |||||||||||||||||||||||||||||
| 843 | my $contains = $string->contains(qr/trices/); | ||||||||||||||||||||||||||||
| 844 | |||||||||||||||||||||||||||||
| 845 | # 1 | ||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||
| 847 | =back | ||||||||||||||||||||||||||||
| 848 | |||||||||||||||||||||||||||||
| 849 | =cut | ||||||||||||||||||||||||||||
| 850 | |||||||||||||||||||||||||||||
| 851 | =head2 default | ||||||||||||||||||||||||||||
| 852 | |||||||||||||||||||||||||||||
| 853 | default() (string) | ||||||||||||||||||||||||||||
| 854 | |||||||||||||||||||||||||||||
| 855 | The default method returns the default value, i.e. C<''>. | ||||||||||||||||||||||||||||
| 856 | |||||||||||||||||||||||||||||
| 857 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 858 | |||||||||||||||||||||||||||||
| 859 | =over 4 | ||||||||||||||||||||||||||||
| 860 | |||||||||||||||||||||||||||||
| 861 | =item default example 1 | ||||||||||||||||||||||||||||
| 862 | |||||||||||||||||||||||||||||
| 863 | # given: synopsis; | ||||||||||||||||||||||||||||
| 864 | |||||||||||||||||||||||||||||
| 865 | my $default = $string->default; | ||||||||||||||||||||||||||||
| 866 | |||||||||||||||||||||||||||||
| 867 | # "" | ||||||||||||||||||||||||||||
| 868 | |||||||||||||||||||||||||||||
| 869 | =back | ||||||||||||||||||||||||||||
| 870 | |||||||||||||||||||||||||||||
| 871 | =cut | ||||||||||||||||||||||||||||
| 872 | |||||||||||||||||||||||||||||
| 873 | =head2 eq | ||||||||||||||||||||||||||||
| 874 | |||||||||||||||||||||||||||||
| 875 | eq(any $arg) (boolean) | ||||||||||||||||||||||||||||
| 876 | |||||||||||||||||||||||||||||
| 877 | The eq method performs an I<"equals"> operation using the argument provided. | ||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||
| 879 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 880 | |||||||||||||||||||||||||||||
| 881 | =over 4 | ||||||||||||||||||||||||||||
| 882 | |||||||||||||||||||||||||||||
| 883 | =item eq example 1 | ||||||||||||||||||||||||||||
| 884 | |||||||||||||||||||||||||||||
| 885 | package main; | ||||||||||||||||||||||||||||
| 886 | |||||||||||||||||||||||||||||
| 887 | use Venus::Array; | ||||||||||||||||||||||||||||
| 888 | use Venus::String; | ||||||||||||||||||||||||||||
| 889 | |||||||||||||||||||||||||||||
| 890 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 891 | my $rvalue = Venus::Array->new; | ||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||
| 893 | my $result = $lvalue->eq($rvalue); | ||||||||||||||||||||||||||||
| 894 | |||||||||||||||||||||||||||||
| 895 | # 0 | ||||||||||||||||||||||||||||
| 896 | |||||||||||||||||||||||||||||
| 897 | =back | ||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||
| 899 | =over 4 | ||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||
| 901 | =item eq example 2 | ||||||||||||||||||||||||||||
| 902 | |||||||||||||||||||||||||||||
| 903 | package main; | ||||||||||||||||||||||||||||
| 904 | |||||||||||||||||||||||||||||
| 905 | use Venus::Code; | ||||||||||||||||||||||||||||
| 906 | use Venus::String; | ||||||||||||||||||||||||||||
| 907 | |||||||||||||||||||||||||||||
| 908 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 909 | my $rvalue = Venus::Code->new; | ||||||||||||||||||||||||||||
| 910 | |||||||||||||||||||||||||||||
| 911 | my $result = $lvalue->eq($rvalue); | ||||||||||||||||||||||||||||
| 912 | |||||||||||||||||||||||||||||
| 913 | # 0 | ||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||
| 915 | =back | ||||||||||||||||||||||||||||
| 916 | |||||||||||||||||||||||||||||
| 917 | =over 4 | ||||||||||||||||||||||||||||
| 918 | |||||||||||||||||||||||||||||
| 919 | =item eq example 3 | ||||||||||||||||||||||||||||
| 920 | |||||||||||||||||||||||||||||
| 921 | package main; | ||||||||||||||||||||||||||||
| 922 | |||||||||||||||||||||||||||||
| 923 | use Venus::Float; | ||||||||||||||||||||||||||||
| 924 | use Venus::String; | ||||||||||||||||||||||||||||
| 925 | |||||||||||||||||||||||||||||
| 926 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 927 | my $rvalue = Venus::Float->new; | ||||||||||||||||||||||||||||
| 928 | |||||||||||||||||||||||||||||
| 929 | my $result = $lvalue->eq($rvalue); | ||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||
| 931 | # 0 | ||||||||||||||||||||||||||||
| 932 | |||||||||||||||||||||||||||||
| 933 | =back | ||||||||||||||||||||||||||||
| 934 | |||||||||||||||||||||||||||||
| 935 | =over 4 | ||||||||||||||||||||||||||||
| 936 | |||||||||||||||||||||||||||||
| 937 | =item eq example 4 | ||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||
| 939 | package main; | ||||||||||||||||||||||||||||
| 940 | |||||||||||||||||||||||||||||
| 941 | use Venus::Hash; | ||||||||||||||||||||||||||||
| 942 | use Venus::String; | ||||||||||||||||||||||||||||
| 943 | |||||||||||||||||||||||||||||
| 944 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 945 | my $rvalue = Venus::Hash->new; | ||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||
| 947 | my $result = $lvalue->eq($rvalue); | ||||||||||||||||||||||||||||
| 948 | |||||||||||||||||||||||||||||
| 949 | # 0 | ||||||||||||||||||||||||||||
| 950 | |||||||||||||||||||||||||||||
| 951 | =back | ||||||||||||||||||||||||||||
| 952 | |||||||||||||||||||||||||||||
| 953 | =over 4 | ||||||||||||||||||||||||||||
| 954 | |||||||||||||||||||||||||||||
| 955 | =item eq example 5 | ||||||||||||||||||||||||||||
| 956 | |||||||||||||||||||||||||||||
| 957 | package main; | ||||||||||||||||||||||||||||
| 958 | |||||||||||||||||||||||||||||
| 959 | use Venus::Number; | ||||||||||||||||||||||||||||
| 960 | use Venus::String; | ||||||||||||||||||||||||||||
| 961 | |||||||||||||||||||||||||||||
| 962 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 963 | my $rvalue = Venus::Number->new; | ||||||||||||||||||||||||||||
| 964 | |||||||||||||||||||||||||||||
| 965 | my $result = $lvalue->eq($rvalue); | ||||||||||||||||||||||||||||
| 966 | |||||||||||||||||||||||||||||
| 967 | # 0 | ||||||||||||||||||||||||||||
| 968 | |||||||||||||||||||||||||||||
| 969 | =back | ||||||||||||||||||||||||||||
| 970 | |||||||||||||||||||||||||||||
| 971 | =over 4 | ||||||||||||||||||||||||||||
| 972 | |||||||||||||||||||||||||||||
| 973 | =item eq example 6 | ||||||||||||||||||||||||||||
| 974 | |||||||||||||||||||||||||||||
| 975 | package main; | ||||||||||||||||||||||||||||
| 976 | |||||||||||||||||||||||||||||
| 977 | use Venus::Regexp; | ||||||||||||||||||||||||||||
| 978 | use Venus::String; | ||||||||||||||||||||||||||||
| 979 | |||||||||||||||||||||||||||||
| 980 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 981 | my $rvalue = Venus::Regexp->new; | ||||||||||||||||||||||||||||
| 982 | |||||||||||||||||||||||||||||
| 983 | my $result = $lvalue->eq($rvalue); | ||||||||||||||||||||||||||||
| 984 | |||||||||||||||||||||||||||||
| 985 | # 0 | ||||||||||||||||||||||||||||
| 986 | |||||||||||||||||||||||||||||
| 987 | =back | ||||||||||||||||||||||||||||
| 988 | |||||||||||||||||||||||||||||
| 989 | =over 4 | ||||||||||||||||||||||||||||
| 990 | |||||||||||||||||||||||||||||
| 991 | =item eq example 7 | ||||||||||||||||||||||||||||
| 992 | |||||||||||||||||||||||||||||
| 993 | package main; | ||||||||||||||||||||||||||||
| 994 | |||||||||||||||||||||||||||||
| 995 | use Venus::Scalar; | ||||||||||||||||||||||||||||
| 996 | use Venus::String; | ||||||||||||||||||||||||||||
| 997 | |||||||||||||||||||||||||||||
| 998 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 999 | my $rvalue = Venus::Scalar->new; | ||||||||||||||||||||||||||||
| 1000 | |||||||||||||||||||||||||||||
| 1001 | my $result = $lvalue->eq($rvalue); | ||||||||||||||||||||||||||||
| 1002 | |||||||||||||||||||||||||||||
| 1003 | # 0 | ||||||||||||||||||||||||||||
| 1004 | |||||||||||||||||||||||||||||
| 1005 | =back | ||||||||||||||||||||||||||||
| 1006 | |||||||||||||||||||||||||||||
| 1007 | =over 4 | ||||||||||||||||||||||||||||
| 1008 | |||||||||||||||||||||||||||||
| 1009 | =item eq example 8 | ||||||||||||||||||||||||||||
| 1010 | |||||||||||||||||||||||||||||
| 1011 | package main; | ||||||||||||||||||||||||||||
| 1012 | |||||||||||||||||||||||||||||
| 1013 | use Venus::String; | ||||||||||||||||||||||||||||
| 1014 | |||||||||||||||||||||||||||||
| 1015 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1016 | my $rvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1017 | |||||||||||||||||||||||||||||
| 1018 | my $result = $lvalue->eq($rvalue); | ||||||||||||||||||||||||||||
| 1019 | |||||||||||||||||||||||||||||
| 1020 | # 1 | ||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||
| 1022 | =back | ||||||||||||||||||||||||||||
| 1023 | |||||||||||||||||||||||||||||
| 1024 | =over 4 | ||||||||||||||||||||||||||||
| 1025 | |||||||||||||||||||||||||||||
| 1026 | =item eq example 9 | ||||||||||||||||||||||||||||
| 1027 | |||||||||||||||||||||||||||||
| 1028 | package main; | ||||||||||||||||||||||||||||
| 1029 | |||||||||||||||||||||||||||||
| 1030 | use Venus::String; | ||||||||||||||||||||||||||||
| 1031 | use Venus::Undef; | ||||||||||||||||||||||||||||
| 1032 | |||||||||||||||||||||||||||||
| 1033 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1034 | my $rvalue = Venus::Undef->new; | ||||||||||||||||||||||||||||
| 1035 | |||||||||||||||||||||||||||||
| 1036 | my $result = $lvalue->eq($rvalue); | ||||||||||||||||||||||||||||
| 1037 | |||||||||||||||||||||||||||||
| 1038 | # 1 | ||||||||||||||||||||||||||||
| 1039 | |||||||||||||||||||||||||||||
| 1040 | =back | ||||||||||||||||||||||||||||
| 1041 | |||||||||||||||||||||||||||||
| 1042 | =cut | ||||||||||||||||||||||||||||
| 1043 | |||||||||||||||||||||||||||||
| 1044 | =head2 format | ||||||||||||||||||||||||||||
| 1045 | |||||||||||||||||||||||||||||
| 1046 | format(any @args) (string) | ||||||||||||||||||||||||||||
| 1047 | |||||||||||||||||||||||||||||
| 1048 | The format method performs a L<perlfunc/sprintf> operation using the underlying | ||||||||||||||||||||||||||||
| 1049 | string and arguments provided and returns the result. | ||||||||||||||||||||||||||||
| 1050 | |||||||||||||||||||||||||||||
| 1051 | I<Since C<3.30>> | ||||||||||||||||||||||||||||
| 1052 | |||||||||||||||||||||||||||||
| 1053 | =over 4 | ||||||||||||||||||||||||||||
| 1054 | |||||||||||||||||||||||||||||
| 1055 | =item format example 1 | ||||||||||||||||||||||||||||
| 1056 | |||||||||||||||||||||||||||||
| 1057 | package main; | ||||||||||||||||||||||||||||
| 1058 | |||||||||||||||||||||||||||||
| 1059 | use Venus::String; | ||||||||||||||||||||||||||||
| 1060 | |||||||||||||||||||||||||||||
| 1061 | my $string = Venus::String->new('hello %s'); | ||||||||||||||||||||||||||||
| 1062 | |||||||||||||||||||||||||||||
| 1063 | my $format = $string->format('world'); | ||||||||||||||||||||||||||||
| 1064 | |||||||||||||||||||||||||||||
| 1065 | # "hello world" | ||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||
| 1067 | =back | ||||||||||||||||||||||||||||
| 1068 | |||||||||||||||||||||||||||||
| 1069 | =over 4 | ||||||||||||||||||||||||||||
| 1070 | |||||||||||||||||||||||||||||
| 1071 | =item format example 2 | ||||||||||||||||||||||||||||
| 1072 | |||||||||||||||||||||||||||||
| 1073 | package main; | ||||||||||||||||||||||||||||
| 1074 | |||||||||||||||||||||||||||||
| 1075 | use Venus::String; | ||||||||||||||||||||||||||||
| 1076 | |||||||||||||||||||||||||||||
| 1077 | my $string = Venus::String->new('id number %08d'); | ||||||||||||||||||||||||||||
| 1078 | |||||||||||||||||||||||||||||
| 1079 | my $format = $string->format(10); | ||||||||||||||||||||||||||||
| 1080 | |||||||||||||||||||||||||||||
| 1081 | # "id number 00000010" | ||||||||||||||||||||||||||||
| 1082 | |||||||||||||||||||||||||||||
| 1083 | =back | ||||||||||||||||||||||||||||
| 1084 | |||||||||||||||||||||||||||||
| 1085 | =cut | ||||||||||||||||||||||||||||
| 1086 | |||||||||||||||||||||||||||||
| 1087 | =head2 ge | ||||||||||||||||||||||||||||
| 1088 | |||||||||||||||||||||||||||||
| 1089 | ge(any $arg) (boolean) | ||||||||||||||||||||||||||||
| 1090 | |||||||||||||||||||||||||||||
| 1091 | The ge method performs a I<"greater-than-or-equal-to"> operation using the | ||||||||||||||||||||||||||||
| 1092 | argument provided. | ||||||||||||||||||||||||||||
| 1093 | |||||||||||||||||||||||||||||
| 1094 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 1095 | |||||||||||||||||||||||||||||
| 1096 | =over 4 | ||||||||||||||||||||||||||||
| 1097 | |||||||||||||||||||||||||||||
| 1098 | =item ge example 1 | ||||||||||||||||||||||||||||
| 1099 | |||||||||||||||||||||||||||||
| 1100 | package main; | ||||||||||||||||||||||||||||
| 1101 | |||||||||||||||||||||||||||||
| 1102 | use Venus::Array; | ||||||||||||||||||||||||||||
| 1103 | use Venus::String; | ||||||||||||||||||||||||||||
| 1104 | |||||||||||||||||||||||||||||
| 1105 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1106 | my $rvalue = Venus::Array->new; | ||||||||||||||||||||||||||||
| 1107 | |||||||||||||||||||||||||||||
| 1108 | my $result = $lvalue->ge($rvalue); | ||||||||||||||||||||||||||||
| 1109 | |||||||||||||||||||||||||||||
| 1110 | # 0 | ||||||||||||||||||||||||||||
| 1111 | |||||||||||||||||||||||||||||
| 1112 | =back | ||||||||||||||||||||||||||||
| 1113 | |||||||||||||||||||||||||||||
| 1114 | =over 4 | ||||||||||||||||||||||||||||
| 1115 | |||||||||||||||||||||||||||||
| 1116 | =item ge example 2 | ||||||||||||||||||||||||||||
| 1117 | |||||||||||||||||||||||||||||
| 1118 | package main; | ||||||||||||||||||||||||||||
| 1119 | |||||||||||||||||||||||||||||
| 1120 | use Venus::Code; | ||||||||||||||||||||||||||||
| 1121 | use Venus::String; | ||||||||||||||||||||||||||||
| 1122 | |||||||||||||||||||||||||||||
| 1123 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1124 | my $rvalue = Venus::Code->new; | ||||||||||||||||||||||||||||
| 1125 | |||||||||||||||||||||||||||||
| 1126 | my $result = $lvalue->ge($rvalue); | ||||||||||||||||||||||||||||
| 1127 | |||||||||||||||||||||||||||||
| 1128 | # 0 | ||||||||||||||||||||||||||||
| 1129 | |||||||||||||||||||||||||||||
| 1130 | =back | ||||||||||||||||||||||||||||
| 1131 | |||||||||||||||||||||||||||||
| 1132 | =over 4 | ||||||||||||||||||||||||||||
| 1133 | |||||||||||||||||||||||||||||
| 1134 | =item ge example 3 | ||||||||||||||||||||||||||||
| 1135 | |||||||||||||||||||||||||||||
| 1136 | package main; | ||||||||||||||||||||||||||||
| 1137 | |||||||||||||||||||||||||||||
| 1138 | use Venus::Float; | ||||||||||||||||||||||||||||
| 1139 | use Venus::String; | ||||||||||||||||||||||||||||
| 1140 | |||||||||||||||||||||||||||||
| 1141 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1142 | my $rvalue = Venus::Float->new; | ||||||||||||||||||||||||||||
| 1143 | |||||||||||||||||||||||||||||
| 1144 | my $result = $lvalue->ge($rvalue); | ||||||||||||||||||||||||||||
| 1145 | |||||||||||||||||||||||||||||
| 1146 | # 0 | ||||||||||||||||||||||||||||
| 1147 | |||||||||||||||||||||||||||||
| 1148 | =back | ||||||||||||||||||||||||||||
| 1149 | |||||||||||||||||||||||||||||
| 1150 | =over 4 | ||||||||||||||||||||||||||||
| 1151 | |||||||||||||||||||||||||||||
| 1152 | =item ge example 4 | ||||||||||||||||||||||||||||
| 1153 | |||||||||||||||||||||||||||||
| 1154 | package main; | ||||||||||||||||||||||||||||
| 1155 | |||||||||||||||||||||||||||||
| 1156 | use Venus::Hash; | ||||||||||||||||||||||||||||
| 1157 | use Venus::String; | ||||||||||||||||||||||||||||
| 1158 | |||||||||||||||||||||||||||||
| 1159 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1160 | my $rvalue = Venus::Hash->new; | ||||||||||||||||||||||||||||
| 1161 | |||||||||||||||||||||||||||||
| 1162 | my $result = $lvalue->ge($rvalue); | ||||||||||||||||||||||||||||
| 1163 | |||||||||||||||||||||||||||||
| 1164 | # 0 | ||||||||||||||||||||||||||||
| 1165 | |||||||||||||||||||||||||||||
| 1166 | =back | ||||||||||||||||||||||||||||
| 1167 | |||||||||||||||||||||||||||||
| 1168 | =over 4 | ||||||||||||||||||||||||||||
| 1169 | |||||||||||||||||||||||||||||
| 1170 | =item ge example 5 | ||||||||||||||||||||||||||||
| 1171 | |||||||||||||||||||||||||||||
| 1172 | package main; | ||||||||||||||||||||||||||||
| 1173 | |||||||||||||||||||||||||||||
| 1174 | use Venus::Number; | ||||||||||||||||||||||||||||
| 1175 | use Venus::String; | ||||||||||||||||||||||||||||
| 1176 | |||||||||||||||||||||||||||||
| 1177 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1178 | my $rvalue = Venus::Number->new; | ||||||||||||||||||||||||||||
| 1179 | |||||||||||||||||||||||||||||
| 1180 | my $result = $lvalue->ge($rvalue); | ||||||||||||||||||||||||||||
| 1181 | |||||||||||||||||||||||||||||
| 1182 | # 0 | ||||||||||||||||||||||||||||
| 1183 | |||||||||||||||||||||||||||||
| 1184 | =back | ||||||||||||||||||||||||||||
| 1185 | |||||||||||||||||||||||||||||
| 1186 | =over 4 | ||||||||||||||||||||||||||||
| 1187 | |||||||||||||||||||||||||||||
| 1188 | =item ge example 6 | ||||||||||||||||||||||||||||
| 1189 | |||||||||||||||||||||||||||||
| 1190 | package main; | ||||||||||||||||||||||||||||
| 1191 | |||||||||||||||||||||||||||||
| 1192 | use Venus::Regexp; | ||||||||||||||||||||||||||||
| 1193 | use Venus::String; | ||||||||||||||||||||||||||||
| 1194 | |||||||||||||||||||||||||||||
| 1195 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1196 | my $rvalue = Venus::Regexp->new; | ||||||||||||||||||||||||||||
| 1197 | |||||||||||||||||||||||||||||
| 1198 | my $result = $lvalue->ge($rvalue); | ||||||||||||||||||||||||||||
| 1199 | |||||||||||||||||||||||||||||
| 1200 | # 0 | ||||||||||||||||||||||||||||
| 1201 | |||||||||||||||||||||||||||||
| 1202 | =back | ||||||||||||||||||||||||||||
| 1203 | |||||||||||||||||||||||||||||
| 1204 | =over 4 | ||||||||||||||||||||||||||||
| 1205 | |||||||||||||||||||||||||||||
| 1206 | =item ge example 7 | ||||||||||||||||||||||||||||
| 1207 | |||||||||||||||||||||||||||||
| 1208 | package main; | ||||||||||||||||||||||||||||
| 1209 | |||||||||||||||||||||||||||||
| 1210 | use Venus::Scalar; | ||||||||||||||||||||||||||||
| 1211 | use Venus::String; | ||||||||||||||||||||||||||||
| 1212 | |||||||||||||||||||||||||||||
| 1213 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1214 | my $rvalue = Venus::Scalar->new; | ||||||||||||||||||||||||||||
| 1215 | |||||||||||||||||||||||||||||
| 1216 | my $result = $lvalue->ge($rvalue); | ||||||||||||||||||||||||||||
| 1217 | |||||||||||||||||||||||||||||
| 1218 | # 0 | ||||||||||||||||||||||||||||
| 1219 | |||||||||||||||||||||||||||||
| 1220 | =back | ||||||||||||||||||||||||||||
| 1221 | |||||||||||||||||||||||||||||
| 1222 | =over 4 | ||||||||||||||||||||||||||||
| 1223 | |||||||||||||||||||||||||||||
| 1224 | =item ge example 8 | ||||||||||||||||||||||||||||
| 1225 | |||||||||||||||||||||||||||||
| 1226 | package main; | ||||||||||||||||||||||||||||
| 1227 | |||||||||||||||||||||||||||||
| 1228 | use Venus::String; | ||||||||||||||||||||||||||||
| 1229 | |||||||||||||||||||||||||||||
| 1230 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1231 | my $rvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1232 | |||||||||||||||||||||||||||||
| 1233 | my $result = $lvalue->ge($rvalue); | ||||||||||||||||||||||||||||
| 1234 | |||||||||||||||||||||||||||||
| 1235 | # 1 | ||||||||||||||||||||||||||||
| 1236 | |||||||||||||||||||||||||||||
| 1237 | =back | ||||||||||||||||||||||||||||
| 1238 | |||||||||||||||||||||||||||||
| 1239 | =over 4 | ||||||||||||||||||||||||||||
| 1240 | |||||||||||||||||||||||||||||
| 1241 | =item ge example 9 | ||||||||||||||||||||||||||||
| 1242 | |||||||||||||||||||||||||||||
| 1243 | package main; | ||||||||||||||||||||||||||||
| 1244 | |||||||||||||||||||||||||||||
| 1245 | use Venus::String; | ||||||||||||||||||||||||||||
| 1246 | use Venus::Undef; | ||||||||||||||||||||||||||||
| 1247 | |||||||||||||||||||||||||||||
| 1248 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1249 | my $rvalue = Venus::Undef->new; | ||||||||||||||||||||||||||||
| 1250 | |||||||||||||||||||||||||||||
| 1251 | my $result = $lvalue->ge($rvalue); | ||||||||||||||||||||||||||||
| 1252 | |||||||||||||||||||||||||||||
| 1253 | # 1 | ||||||||||||||||||||||||||||
| 1254 | |||||||||||||||||||||||||||||
| 1255 | =back | ||||||||||||||||||||||||||||
| 1256 | |||||||||||||||||||||||||||||
| 1257 | =cut | ||||||||||||||||||||||||||||
| 1258 | |||||||||||||||||||||||||||||
| 1259 | =head2 gele | ||||||||||||||||||||||||||||
| 1260 | |||||||||||||||||||||||||||||
| 1261 | gele(any $arg1, any $arg2) (boolean) | ||||||||||||||||||||||||||||
| 1262 | |||||||||||||||||||||||||||||
| 1263 | The gele method performs a I<"greater-than-or-equal-to"> operation on the 1st | ||||||||||||||||||||||||||||
| 1264 | argument, and I<"lesser-than-or-equal-to"> operation on the 2nd argument. | ||||||||||||||||||||||||||||
| 1265 | |||||||||||||||||||||||||||||
| 1266 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 1267 | |||||||||||||||||||||||||||||
| 1268 | =over 4 | ||||||||||||||||||||||||||||
| 1269 | |||||||||||||||||||||||||||||
| 1270 | =item gele example 1 | ||||||||||||||||||||||||||||
| 1271 | |||||||||||||||||||||||||||||
| 1272 | package main; | ||||||||||||||||||||||||||||
| 1273 | |||||||||||||||||||||||||||||
| 1274 | use Venus::Array; | ||||||||||||||||||||||||||||
| 1275 | use Venus::String; | ||||||||||||||||||||||||||||
| 1276 | |||||||||||||||||||||||||||||
| 1277 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1278 | my $rvalue = Venus::Array->new; | ||||||||||||||||||||||||||||
| 1279 | |||||||||||||||||||||||||||||
| 1280 | my $result = $lvalue->gele($rvalue); | ||||||||||||||||||||||||||||
| 1281 | |||||||||||||||||||||||||||||
| 1282 | # 0 | ||||||||||||||||||||||||||||
| 1283 | |||||||||||||||||||||||||||||
| 1284 | =back | ||||||||||||||||||||||||||||
| 1285 | |||||||||||||||||||||||||||||
| 1286 | =over 4 | ||||||||||||||||||||||||||||
| 1287 | |||||||||||||||||||||||||||||
| 1288 | =item gele example 2 | ||||||||||||||||||||||||||||
| 1289 | |||||||||||||||||||||||||||||
| 1290 | package main; | ||||||||||||||||||||||||||||
| 1291 | |||||||||||||||||||||||||||||
| 1292 | use Venus::Code; | ||||||||||||||||||||||||||||
| 1293 | use Venus::String; | ||||||||||||||||||||||||||||
| 1294 | |||||||||||||||||||||||||||||
| 1295 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1296 | my $rvalue = Venus::Code->new; | ||||||||||||||||||||||||||||
| 1297 | |||||||||||||||||||||||||||||
| 1298 | my $result = $lvalue->gele($rvalue); | ||||||||||||||||||||||||||||
| 1299 | |||||||||||||||||||||||||||||
| 1300 | # 0 | ||||||||||||||||||||||||||||
| 1301 | |||||||||||||||||||||||||||||
| 1302 | =back | ||||||||||||||||||||||||||||
| 1303 | |||||||||||||||||||||||||||||
| 1304 | =over 4 | ||||||||||||||||||||||||||||
| 1305 | |||||||||||||||||||||||||||||
| 1306 | =item gele example 3 | ||||||||||||||||||||||||||||
| 1307 | |||||||||||||||||||||||||||||
| 1308 | package main; | ||||||||||||||||||||||||||||
| 1309 | |||||||||||||||||||||||||||||
| 1310 | use Venus::Float; | ||||||||||||||||||||||||||||
| 1311 | use Venus::String; | ||||||||||||||||||||||||||||
| 1312 | |||||||||||||||||||||||||||||
| 1313 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1314 | my $rvalue = Venus::Float->new; | ||||||||||||||||||||||||||||
| 1315 | |||||||||||||||||||||||||||||
| 1316 | my $result = $lvalue->gele($rvalue); | ||||||||||||||||||||||||||||
| 1317 | |||||||||||||||||||||||||||||
| 1318 | # 0 | ||||||||||||||||||||||||||||
| 1319 | |||||||||||||||||||||||||||||
| 1320 | =back | ||||||||||||||||||||||||||||
| 1321 | |||||||||||||||||||||||||||||
| 1322 | =over 4 | ||||||||||||||||||||||||||||
| 1323 | |||||||||||||||||||||||||||||
| 1324 | =item gele example 4 | ||||||||||||||||||||||||||||
| 1325 | |||||||||||||||||||||||||||||
| 1326 | package main; | ||||||||||||||||||||||||||||
| 1327 | |||||||||||||||||||||||||||||
| 1328 | use Venus::Hash; | ||||||||||||||||||||||||||||
| 1329 | use Venus::String; | ||||||||||||||||||||||||||||
| 1330 | |||||||||||||||||||||||||||||
| 1331 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1332 | my $rvalue = Venus::Hash->new; | ||||||||||||||||||||||||||||
| 1333 | |||||||||||||||||||||||||||||
| 1334 | my $result = $lvalue->gele($rvalue); | ||||||||||||||||||||||||||||
| 1335 | |||||||||||||||||||||||||||||
| 1336 | # 0 | ||||||||||||||||||||||||||||
| 1337 | |||||||||||||||||||||||||||||
| 1338 | =back | ||||||||||||||||||||||||||||
| 1339 | |||||||||||||||||||||||||||||
| 1340 | =over 4 | ||||||||||||||||||||||||||||
| 1341 | |||||||||||||||||||||||||||||
| 1342 | =item gele example 5 | ||||||||||||||||||||||||||||
| 1343 | |||||||||||||||||||||||||||||
| 1344 | package main; | ||||||||||||||||||||||||||||
| 1345 | |||||||||||||||||||||||||||||
| 1346 | use Venus::Number; | ||||||||||||||||||||||||||||
| 1347 | use Venus::String; | ||||||||||||||||||||||||||||
| 1348 | |||||||||||||||||||||||||||||
| 1349 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1350 | my $rvalue = Venus::Number->new; | ||||||||||||||||||||||||||||
| 1351 | |||||||||||||||||||||||||||||
| 1352 | my $result = $lvalue->gele($rvalue); | ||||||||||||||||||||||||||||
| 1353 | |||||||||||||||||||||||||||||
| 1354 | # 0 | ||||||||||||||||||||||||||||
| 1355 | |||||||||||||||||||||||||||||
| 1356 | =back | ||||||||||||||||||||||||||||
| 1357 | |||||||||||||||||||||||||||||
| 1358 | =over 4 | ||||||||||||||||||||||||||||
| 1359 | |||||||||||||||||||||||||||||
| 1360 | =item gele example 6 | ||||||||||||||||||||||||||||
| 1361 | |||||||||||||||||||||||||||||
| 1362 | package main; | ||||||||||||||||||||||||||||
| 1363 | |||||||||||||||||||||||||||||
| 1364 | use Venus::Regexp; | ||||||||||||||||||||||||||||
| 1365 | use Venus::String; | ||||||||||||||||||||||||||||
| 1366 | |||||||||||||||||||||||||||||
| 1367 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1368 | my $rvalue = Venus::Regexp->new; | ||||||||||||||||||||||||||||
| 1369 | |||||||||||||||||||||||||||||
| 1370 | my $result = $lvalue->gele($rvalue); | ||||||||||||||||||||||||||||
| 1371 | |||||||||||||||||||||||||||||
| 1372 | # 0 | ||||||||||||||||||||||||||||
| 1373 | |||||||||||||||||||||||||||||
| 1374 | =back | ||||||||||||||||||||||||||||
| 1375 | |||||||||||||||||||||||||||||
| 1376 | =over 4 | ||||||||||||||||||||||||||||
| 1377 | |||||||||||||||||||||||||||||
| 1378 | =item gele example 7 | ||||||||||||||||||||||||||||
| 1379 | |||||||||||||||||||||||||||||
| 1380 | package main; | ||||||||||||||||||||||||||||
| 1381 | |||||||||||||||||||||||||||||
| 1382 | use Venus::Scalar; | ||||||||||||||||||||||||||||
| 1383 | use Venus::String; | ||||||||||||||||||||||||||||
| 1384 | |||||||||||||||||||||||||||||
| 1385 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1386 | my $rvalue = Venus::Scalar->new; | ||||||||||||||||||||||||||||
| 1387 | |||||||||||||||||||||||||||||
| 1388 | my $result = $lvalue->gele($rvalue); | ||||||||||||||||||||||||||||
| 1389 | |||||||||||||||||||||||||||||
| 1390 | # 0 | ||||||||||||||||||||||||||||
| 1391 | |||||||||||||||||||||||||||||
| 1392 | =back | ||||||||||||||||||||||||||||
| 1393 | |||||||||||||||||||||||||||||
| 1394 | =over 4 | ||||||||||||||||||||||||||||
| 1395 | |||||||||||||||||||||||||||||
| 1396 | =item gele example 8 | ||||||||||||||||||||||||||||
| 1397 | |||||||||||||||||||||||||||||
| 1398 | package main; | ||||||||||||||||||||||||||||
| 1399 | |||||||||||||||||||||||||||||
| 1400 | use Venus::String; | ||||||||||||||||||||||||||||
| 1401 | |||||||||||||||||||||||||||||
| 1402 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1403 | my $rvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1404 | |||||||||||||||||||||||||||||
| 1405 | my $result = $lvalue->gele($rvalue); | ||||||||||||||||||||||||||||
| 1406 | |||||||||||||||||||||||||||||
| 1407 | # 1 | ||||||||||||||||||||||||||||
| 1408 | |||||||||||||||||||||||||||||
| 1409 | =back | ||||||||||||||||||||||||||||
| 1410 | |||||||||||||||||||||||||||||
| 1411 | =over 4 | ||||||||||||||||||||||||||||
| 1412 | |||||||||||||||||||||||||||||
| 1413 | =item gele example 9 | ||||||||||||||||||||||||||||
| 1414 | |||||||||||||||||||||||||||||
| 1415 | package main; | ||||||||||||||||||||||||||||
| 1416 | |||||||||||||||||||||||||||||
| 1417 | use Venus::String; | ||||||||||||||||||||||||||||
| 1418 | use Venus::Undef; | ||||||||||||||||||||||||||||
| 1419 | |||||||||||||||||||||||||||||
| 1420 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1421 | my $rvalue = Venus::Undef->new; | ||||||||||||||||||||||||||||
| 1422 | |||||||||||||||||||||||||||||
| 1423 | my $result = $lvalue->gele($rvalue); | ||||||||||||||||||||||||||||
| 1424 | |||||||||||||||||||||||||||||
| 1425 | # 1 | ||||||||||||||||||||||||||||
| 1426 | |||||||||||||||||||||||||||||
| 1427 | =back | ||||||||||||||||||||||||||||
| 1428 | |||||||||||||||||||||||||||||
| 1429 | =cut | ||||||||||||||||||||||||||||
| 1430 | |||||||||||||||||||||||||||||
| 1431 | =head2 gt | ||||||||||||||||||||||||||||
| 1432 | |||||||||||||||||||||||||||||
| 1433 | gt(any $arg) (boolean) | ||||||||||||||||||||||||||||
| 1434 | |||||||||||||||||||||||||||||
| 1435 | The gt method performs a I<"greater-than"> operation using the argument provided. | ||||||||||||||||||||||||||||
| 1436 | |||||||||||||||||||||||||||||
| 1437 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 1438 | |||||||||||||||||||||||||||||
| 1439 | =over 4 | ||||||||||||||||||||||||||||
| 1440 | |||||||||||||||||||||||||||||
| 1441 | =item gt example 1 | ||||||||||||||||||||||||||||
| 1442 | |||||||||||||||||||||||||||||
| 1443 | package main; | ||||||||||||||||||||||||||||
| 1444 | |||||||||||||||||||||||||||||
| 1445 | use Venus::Array; | ||||||||||||||||||||||||||||
| 1446 | use Venus::String; | ||||||||||||||||||||||||||||
| 1447 | |||||||||||||||||||||||||||||
| 1448 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1449 | my $rvalue = Venus::Array->new; | ||||||||||||||||||||||||||||
| 1450 | |||||||||||||||||||||||||||||
| 1451 | my $result = $lvalue->gt($rvalue); | ||||||||||||||||||||||||||||
| 1452 | |||||||||||||||||||||||||||||
| 1453 | # 0 | ||||||||||||||||||||||||||||
| 1454 | |||||||||||||||||||||||||||||
| 1455 | =back | ||||||||||||||||||||||||||||
| 1456 | |||||||||||||||||||||||||||||
| 1457 | =over 4 | ||||||||||||||||||||||||||||
| 1458 | |||||||||||||||||||||||||||||
| 1459 | =item gt example 2 | ||||||||||||||||||||||||||||
| 1460 | |||||||||||||||||||||||||||||
| 1461 | package main; | ||||||||||||||||||||||||||||
| 1462 | |||||||||||||||||||||||||||||
| 1463 | use Venus::Code; | ||||||||||||||||||||||||||||
| 1464 | use Venus::String; | ||||||||||||||||||||||||||||
| 1465 | |||||||||||||||||||||||||||||
| 1466 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1467 | my $rvalue = Venus::Code->new; | ||||||||||||||||||||||||||||
| 1468 | |||||||||||||||||||||||||||||
| 1469 | my $result = $lvalue->gt($rvalue); | ||||||||||||||||||||||||||||
| 1470 | |||||||||||||||||||||||||||||
| 1471 | # 0 | ||||||||||||||||||||||||||||
| 1472 | |||||||||||||||||||||||||||||
| 1473 | =back | ||||||||||||||||||||||||||||
| 1474 | |||||||||||||||||||||||||||||
| 1475 | =over 4 | ||||||||||||||||||||||||||||
| 1476 | |||||||||||||||||||||||||||||
| 1477 | =item gt example 3 | ||||||||||||||||||||||||||||
| 1478 | |||||||||||||||||||||||||||||
| 1479 | package main; | ||||||||||||||||||||||||||||
| 1480 | |||||||||||||||||||||||||||||
| 1481 | use Venus::Float; | ||||||||||||||||||||||||||||
| 1482 | use Venus::String; | ||||||||||||||||||||||||||||
| 1483 | |||||||||||||||||||||||||||||
| 1484 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1485 | my $rvalue = Venus::Float->new; | ||||||||||||||||||||||||||||
| 1486 | |||||||||||||||||||||||||||||
| 1487 | my $result = $lvalue->gt($rvalue); | ||||||||||||||||||||||||||||
| 1488 | |||||||||||||||||||||||||||||
| 1489 | # 0 | ||||||||||||||||||||||||||||
| 1490 | |||||||||||||||||||||||||||||
| 1491 | =back | ||||||||||||||||||||||||||||
| 1492 | |||||||||||||||||||||||||||||
| 1493 | =over 4 | ||||||||||||||||||||||||||||
| 1494 | |||||||||||||||||||||||||||||
| 1495 | =item gt example 4 | ||||||||||||||||||||||||||||
| 1496 | |||||||||||||||||||||||||||||
| 1497 | package main; | ||||||||||||||||||||||||||||
| 1498 | |||||||||||||||||||||||||||||
| 1499 | use Venus::Hash; | ||||||||||||||||||||||||||||
| 1500 | use Venus::String; | ||||||||||||||||||||||||||||
| 1501 | |||||||||||||||||||||||||||||
| 1502 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1503 | my $rvalue = Venus::Hash->new; | ||||||||||||||||||||||||||||
| 1504 | |||||||||||||||||||||||||||||
| 1505 | my $result = $lvalue->gt($rvalue); | ||||||||||||||||||||||||||||
| 1506 | |||||||||||||||||||||||||||||
| 1507 | # 0 | ||||||||||||||||||||||||||||
| 1508 | |||||||||||||||||||||||||||||
| 1509 | =back | ||||||||||||||||||||||||||||
| 1510 | |||||||||||||||||||||||||||||
| 1511 | =over 4 | ||||||||||||||||||||||||||||
| 1512 | |||||||||||||||||||||||||||||
| 1513 | =item gt example 5 | ||||||||||||||||||||||||||||
| 1514 | |||||||||||||||||||||||||||||
| 1515 | package main; | ||||||||||||||||||||||||||||
| 1516 | |||||||||||||||||||||||||||||
| 1517 | use Venus::Number; | ||||||||||||||||||||||||||||
| 1518 | use Venus::String; | ||||||||||||||||||||||||||||
| 1519 | |||||||||||||||||||||||||||||
| 1520 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1521 | my $rvalue = Venus::Number->new; | ||||||||||||||||||||||||||||
| 1522 | |||||||||||||||||||||||||||||
| 1523 | my $result = $lvalue->gt($rvalue); | ||||||||||||||||||||||||||||
| 1524 | |||||||||||||||||||||||||||||
| 1525 | # 0 | ||||||||||||||||||||||||||||
| 1526 | |||||||||||||||||||||||||||||
| 1527 | =back | ||||||||||||||||||||||||||||
| 1528 | |||||||||||||||||||||||||||||
| 1529 | =over 4 | ||||||||||||||||||||||||||||
| 1530 | |||||||||||||||||||||||||||||
| 1531 | =item gt example 6 | ||||||||||||||||||||||||||||
| 1532 | |||||||||||||||||||||||||||||
| 1533 | package main; | ||||||||||||||||||||||||||||
| 1534 | |||||||||||||||||||||||||||||
| 1535 | use Venus::Regexp; | ||||||||||||||||||||||||||||
| 1536 | use Venus::String; | ||||||||||||||||||||||||||||
| 1537 | |||||||||||||||||||||||||||||
| 1538 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1539 | my $rvalue = Venus::Regexp->new; | ||||||||||||||||||||||||||||
| 1540 | |||||||||||||||||||||||||||||
| 1541 | my $result = $lvalue->gt($rvalue); | ||||||||||||||||||||||||||||
| 1542 | |||||||||||||||||||||||||||||
| 1543 | # 0 | ||||||||||||||||||||||||||||
| 1544 | |||||||||||||||||||||||||||||
| 1545 | =back | ||||||||||||||||||||||||||||
| 1546 | |||||||||||||||||||||||||||||
| 1547 | =over 4 | ||||||||||||||||||||||||||||
| 1548 | |||||||||||||||||||||||||||||
| 1549 | =item gt example 7 | ||||||||||||||||||||||||||||
| 1550 | |||||||||||||||||||||||||||||
| 1551 | package main; | ||||||||||||||||||||||||||||
| 1552 | |||||||||||||||||||||||||||||
| 1553 | use Venus::Scalar; | ||||||||||||||||||||||||||||
| 1554 | use Venus::String; | ||||||||||||||||||||||||||||
| 1555 | |||||||||||||||||||||||||||||
| 1556 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1557 | my $rvalue = Venus::Scalar->new; | ||||||||||||||||||||||||||||
| 1558 | |||||||||||||||||||||||||||||
| 1559 | my $result = $lvalue->gt($rvalue); | ||||||||||||||||||||||||||||
| 1560 | |||||||||||||||||||||||||||||
| 1561 | # 0 | ||||||||||||||||||||||||||||
| 1562 | |||||||||||||||||||||||||||||
| 1563 | =back | ||||||||||||||||||||||||||||
| 1564 | |||||||||||||||||||||||||||||
| 1565 | =over 4 | ||||||||||||||||||||||||||||
| 1566 | |||||||||||||||||||||||||||||
| 1567 | =item gt example 8 | ||||||||||||||||||||||||||||
| 1568 | |||||||||||||||||||||||||||||
| 1569 | package main; | ||||||||||||||||||||||||||||
| 1570 | |||||||||||||||||||||||||||||
| 1571 | use Venus::String; | ||||||||||||||||||||||||||||
| 1572 | |||||||||||||||||||||||||||||
| 1573 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1574 | my $rvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1575 | |||||||||||||||||||||||||||||
| 1576 | my $result = $lvalue->gt($rvalue); | ||||||||||||||||||||||||||||
| 1577 | |||||||||||||||||||||||||||||
| 1578 | # 0 | ||||||||||||||||||||||||||||
| 1579 | |||||||||||||||||||||||||||||
| 1580 | =back | ||||||||||||||||||||||||||||
| 1581 | |||||||||||||||||||||||||||||
| 1582 | =over 4 | ||||||||||||||||||||||||||||
| 1583 | |||||||||||||||||||||||||||||
| 1584 | =item gt example 9 | ||||||||||||||||||||||||||||
| 1585 | |||||||||||||||||||||||||||||
| 1586 | package main; | ||||||||||||||||||||||||||||
| 1587 | |||||||||||||||||||||||||||||
| 1588 | use Venus::String; | ||||||||||||||||||||||||||||
| 1589 | use Venus::Undef; | ||||||||||||||||||||||||||||
| 1590 | |||||||||||||||||||||||||||||
| 1591 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1592 | my $rvalue = Venus::Undef->new; | ||||||||||||||||||||||||||||
| 1593 | |||||||||||||||||||||||||||||
| 1594 | my $result = $lvalue->gt($rvalue); | ||||||||||||||||||||||||||||
| 1595 | |||||||||||||||||||||||||||||
| 1596 | # 0 | ||||||||||||||||||||||||||||
| 1597 | |||||||||||||||||||||||||||||
| 1598 | =back | ||||||||||||||||||||||||||||
| 1599 | |||||||||||||||||||||||||||||
| 1600 | =cut | ||||||||||||||||||||||||||||
| 1601 | |||||||||||||||||||||||||||||
| 1602 | =head2 gtlt | ||||||||||||||||||||||||||||
| 1603 | |||||||||||||||||||||||||||||
| 1604 | gtlt(any $arg1, any $arg2) (boolean) | ||||||||||||||||||||||||||||
| 1605 | |||||||||||||||||||||||||||||
| 1606 | The gtlt method performs a I<"greater-than"> operation on the 1st argument, and | ||||||||||||||||||||||||||||
| 1607 | I<"lesser-than"> operation on the 2nd argument. | ||||||||||||||||||||||||||||
| 1608 | |||||||||||||||||||||||||||||
| 1609 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 1610 | |||||||||||||||||||||||||||||
| 1611 | =over 4 | ||||||||||||||||||||||||||||
| 1612 | |||||||||||||||||||||||||||||
| 1613 | =item gtlt example 1 | ||||||||||||||||||||||||||||
| 1614 | |||||||||||||||||||||||||||||
| 1615 | package main; | ||||||||||||||||||||||||||||
| 1616 | |||||||||||||||||||||||||||||
| 1617 | use Venus::Array; | ||||||||||||||||||||||||||||
| 1618 | use Venus::String; | ||||||||||||||||||||||||||||
| 1619 | |||||||||||||||||||||||||||||
| 1620 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1621 | my $rvalue = Venus::Array->new; | ||||||||||||||||||||||||||||
| 1622 | |||||||||||||||||||||||||||||
| 1623 | my $result = $lvalue->gtlt($rvalue); | ||||||||||||||||||||||||||||
| 1624 | |||||||||||||||||||||||||||||
| 1625 | # 0 | ||||||||||||||||||||||||||||
| 1626 | |||||||||||||||||||||||||||||
| 1627 | =back | ||||||||||||||||||||||||||||
| 1628 | |||||||||||||||||||||||||||||
| 1629 | =over 4 | ||||||||||||||||||||||||||||
| 1630 | |||||||||||||||||||||||||||||
| 1631 | =item gtlt example 2 | ||||||||||||||||||||||||||||
| 1632 | |||||||||||||||||||||||||||||
| 1633 | package main; | ||||||||||||||||||||||||||||
| 1634 | |||||||||||||||||||||||||||||
| 1635 | use Venus::Code; | ||||||||||||||||||||||||||||
| 1636 | use Venus::String; | ||||||||||||||||||||||||||||
| 1637 | |||||||||||||||||||||||||||||
| 1638 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1639 | my $rvalue = Venus::Code->new; | ||||||||||||||||||||||||||||
| 1640 | |||||||||||||||||||||||||||||
| 1641 | my $result = $lvalue->gtlt($rvalue); | ||||||||||||||||||||||||||||
| 1642 | |||||||||||||||||||||||||||||
| 1643 | # 0 | ||||||||||||||||||||||||||||
| 1644 | |||||||||||||||||||||||||||||
| 1645 | =back | ||||||||||||||||||||||||||||
| 1646 | |||||||||||||||||||||||||||||
| 1647 | =over 4 | ||||||||||||||||||||||||||||
| 1648 | |||||||||||||||||||||||||||||
| 1649 | =item gtlt example 3 | ||||||||||||||||||||||||||||
| 1650 | |||||||||||||||||||||||||||||
| 1651 | package main; | ||||||||||||||||||||||||||||
| 1652 | |||||||||||||||||||||||||||||
| 1653 | use Venus::Float; | ||||||||||||||||||||||||||||
| 1654 | use Venus::String; | ||||||||||||||||||||||||||||
| 1655 | |||||||||||||||||||||||||||||
| 1656 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1657 | my $rvalue = Venus::Float->new; | ||||||||||||||||||||||||||||
| 1658 | |||||||||||||||||||||||||||||
| 1659 | my $result = $lvalue->gtlt($rvalue); | ||||||||||||||||||||||||||||
| 1660 | |||||||||||||||||||||||||||||
| 1661 | # 0 | ||||||||||||||||||||||||||||
| 1662 | |||||||||||||||||||||||||||||
| 1663 | =back | ||||||||||||||||||||||||||||
| 1664 | |||||||||||||||||||||||||||||
| 1665 | =over 4 | ||||||||||||||||||||||||||||
| 1666 | |||||||||||||||||||||||||||||
| 1667 | =item gtlt example 4 | ||||||||||||||||||||||||||||
| 1668 | |||||||||||||||||||||||||||||
| 1669 | package main; | ||||||||||||||||||||||||||||
| 1670 | |||||||||||||||||||||||||||||
| 1671 | use Venus::Hash; | ||||||||||||||||||||||||||||
| 1672 | use Venus::String; | ||||||||||||||||||||||||||||
| 1673 | |||||||||||||||||||||||||||||
| 1674 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1675 | my $rvalue = Venus::Hash->new; | ||||||||||||||||||||||||||||
| 1676 | |||||||||||||||||||||||||||||
| 1677 | my $result = $lvalue->gtlt($rvalue); | ||||||||||||||||||||||||||||
| 1678 | |||||||||||||||||||||||||||||
| 1679 | # 0 | ||||||||||||||||||||||||||||
| 1680 | |||||||||||||||||||||||||||||
| 1681 | =back | ||||||||||||||||||||||||||||
| 1682 | |||||||||||||||||||||||||||||
| 1683 | =over 4 | ||||||||||||||||||||||||||||
| 1684 | |||||||||||||||||||||||||||||
| 1685 | =item gtlt example 5 | ||||||||||||||||||||||||||||
| 1686 | |||||||||||||||||||||||||||||
| 1687 | package main; | ||||||||||||||||||||||||||||
| 1688 | |||||||||||||||||||||||||||||
| 1689 | use Venus::Number; | ||||||||||||||||||||||||||||
| 1690 | use Venus::String; | ||||||||||||||||||||||||||||
| 1691 | |||||||||||||||||||||||||||||
| 1692 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1693 | my $rvalue = Venus::Number->new; | ||||||||||||||||||||||||||||
| 1694 | |||||||||||||||||||||||||||||
| 1695 | my $result = $lvalue->gtlt($rvalue); | ||||||||||||||||||||||||||||
| 1696 | |||||||||||||||||||||||||||||
| 1697 | # 0 | ||||||||||||||||||||||||||||
| 1698 | |||||||||||||||||||||||||||||
| 1699 | =back | ||||||||||||||||||||||||||||
| 1700 | |||||||||||||||||||||||||||||
| 1701 | =over 4 | ||||||||||||||||||||||||||||
| 1702 | |||||||||||||||||||||||||||||
| 1703 | =item gtlt example 6 | ||||||||||||||||||||||||||||
| 1704 | |||||||||||||||||||||||||||||
| 1705 | package main; | ||||||||||||||||||||||||||||
| 1706 | |||||||||||||||||||||||||||||
| 1707 | use Venus::Regexp; | ||||||||||||||||||||||||||||
| 1708 | use Venus::String; | ||||||||||||||||||||||||||||
| 1709 | |||||||||||||||||||||||||||||
| 1710 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1711 | my $rvalue = Venus::Regexp->new; | ||||||||||||||||||||||||||||
| 1712 | |||||||||||||||||||||||||||||
| 1713 | my $result = $lvalue->gtlt($rvalue); | ||||||||||||||||||||||||||||
| 1714 | |||||||||||||||||||||||||||||
| 1715 | # 0 | ||||||||||||||||||||||||||||
| 1716 | |||||||||||||||||||||||||||||
| 1717 | =back | ||||||||||||||||||||||||||||
| 1718 | |||||||||||||||||||||||||||||
| 1719 | =over 4 | ||||||||||||||||||||||||||||
| 1720 | |||||||||||||||||||||||||||||
| 1721 | =item gtlt example 7 | ||||||||||||||||||||||||||||
| 1722 | |||||||||||||||||||||||||||||
| 1723 | package main; | ||||||||||||||||||||||||||||
| 1724 | |||||||||||||||||||||||||||||
| 1725 | use Venus::Scalar; | ||||||||||||||||||||||||||||
| 1726 | use Venus::String; | ||||||||||||||||||||||||||||
| 1727 | |||||||||||||||||||||||||||||
| 1728 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1729 | my $rvalue = Venus::Scalar->new; | ||||||||||||||||||||||||||||
| 1730 | |||||||||||||||||||||||||||||
| 1731 | my $result = $lvalue->gtlt($rvalue); | ||||||||||||||||||||||||||||
| 1732 | |||||||||||||||||||||||||||||
| 1733 | # 0 | ||||||||||||||||||||||||||||
| 1734 | |||||||||||||||||||||||||||||
| 1735 | =back | ||||||||||||||||||||||||||||
| 1736 | |||||||||||||||||||||||||||||
| 1737 | =over 4 | ||||||||||||||||||||||||||||
| 1738 | |||||||||||||||||||||||||||||
| 1739 | =item gtlt example 8 | ||||||||||||||||||||||||||||
| 1740 | |||||||||||||||||||||||||||||
| 1741 | package main; | ||||||||||||||||||||||||||||
| 1742 | |||||||||||||||||||||||||||||
| 1743 | use Venus::String; | ||||||||||||||||||||||||||||
| 1744 | |||||||||||||||||||||||||||||
| 1745 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1746 | my $rvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1747 | |||||||||||||||||||||||||||||
| 1748 | my $result = $lvalue->gtlt($rvalue); | ||||||||||||||||||||||||||||
| 1749 | |||||||||||||||||||||||||||||
| 1750 | # 0 | ||||||||||||||||||||||||||||
| 1751 | |||||||||||||||||||||||||||||
| 1752 | =back | ||||||||||||||||||||||||||||
| 1753 | |||||||||||||||||||||||||||||
| 1754 | =over 4 | ||||||||||||||||||||||||||||
| 1755 | |||||||||||||||||||||||||||||
| 1756 | =item gtlt example 9 | ||||||||||||||||||||||||||||
| 1757 | |||||||||||||||||||||||||||||
| 1758 | package main; | ||||||||||||||||||||||||||||
| 1759 | |||||||||||||||||||||||||||||
| 1760 | use Venus::String; | ||||||||||||||||||||||||||||
| 1761 | use Venus::Undef; | ||||||||||||||||||||||||||||
| 1762 | |||||||||||||||||||||||||||||
| 1763 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1764 | my $rvalue = Venus::Undef->new; | ||||||||||||||||||||||||||||
| 1765 | |||||||||||||||||||||||||||||
| 1766 | my $result = $lvalue->gtlt($rvalue); | ||||||||||||||||||||||||||||
| 1767 | |||||||||||||||||||||||||||||
| 1768 | # 0 | ||||||||||||||||||||||||||||
| 1769 | |||||||||||||||||||||||||||||
| 1770 | =back | ||||||||||||||||||||||||||||
| 1771 | |||||||||||||||||||||||||||||
| 1772 | =cut | ||||||||||||||||||||||||||||
| 1773 | |||||||||||||||||||||||||||||
| 1774 | =head2 hex | ||||||||||||||||||||||||||||
| 1775 | |||||||||||||||||||||||||||||
| 1776 | hex() (string) | ||||||||||||||||||||||||||||
| 1777 | |||||||||||||||||||||||||||||
| 1778 | The hex method returns the value resulting from interpreting the string as a | ||||||||||||||||||||||||||||
| 1779 | hex string. | ||||||||||||||||||||||||||||
| 1780 | |||||||||||||||||||||||||||||
| 1781 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 1782 | |||||||||||||||||||||||||||||
| 1783 | =over 4 | ||||||||||||||||||||||||||||
| 1784 | |||||||||||||||||||||||||||||
| 1785 | =item hex example 1 | ||||||||||||||||||||||||||||
| 1786 | |||||||||||||||||||||||||||||
| 1787 | package main; | ||||||||||||||||||||||||||||
| 1788 | |||||||||||||||||||||||||||||
| 1789 | use Venus::String; | ||||||||||||||||||||||||||||
| 1790 | |||||||||||||||||||||||||||||
| 1791 | my $string = Venus::String->new('0xaf'); | ||||||||||||||||||||||||||||
| 1792 | |||||||||||||||||||||||||||||
| 1793 | my $hex = $string->hex; | ||||||||||||||||||||||||||||
| 1794 | |||||||||||||||||||||||||||||
| 1795 | # 175 | ||||||||||||||||||||||||||||
| 1796 | |||||||||||||||||||||||||||||
| 1797 | =back | ||||||||||||||||||||||||||||
| 1798 | |||||||||||||||||||||||||||||
| 1799 | =cut | ||||||||||||||||||||||||||||
| 1800 | |||||||||||||||||||||||||||||
| 1801 | =head2 index | ||||||||||||||||||||||||||||
| 1802 | |||||||||||||||||||||||||||||
| 1803 | index(string $substr, number $start) (number) | ||||||||||||||||||||||||||||
| 1804 | |||||||||||||||||||||||||||||
| 1805 | The index method searches for the argument within the string and returns the | ||||||||||||||||||||||||||||
| 1806 | position of the first occurrence of the argument. | ||||||||||||||||||||||||||||
| 1807 | |||||||||||||||||||||||||||||
| 1808 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 1809 | |||||||||||||||||||||||||||||
| 1810 | =over 4 | ||||||||||||||||||||||||||||
| 1811 | |||||||||||||||||||||||||||||
| 1812 | =item index example 1 | ||||||||||||||||||||||||||||
| 1813 | |||||||||||||||||||||||||||||
| 1814 | package main; | ||||||||||||||||||||||||||||
| 1815 | |||||||||||||||||||||||||||||
| 1816 | use Venus::String; | ||||||||||||||||||||||||||||
| 1817 | |||||||||||||||||||||||||||||
| 1818 | my $string = Venus::String->new('unexplainable'); | ||||||||||||||||||||||||||||
| 1819 | |||||||||||||||||||||||||||||
| 1820 | my $index = $string->index('explain'); | ||||||||||||||||||||||||||||
| 1821 | |||||||||||||||||||||||||||||
| 1822 | # 2 | ||||||||||||||||||||||||||||
| 1823 | |||||||||||||||||||||||||||||
| 1824 | =back | ||||||||||||||||||||||||||||
| 1825 | |||||||||||||||||||||||||||||
| 1826 | =over 4 | ||||||||||||||||||||||||||||
| 1827 | |||||||||||||||||||||||||||||
| 1828 | =item index example 2 | ||||||||||||||||||||||||||||
| 1829 | |||||||||||||||||||||||||||||
| 1830 | package main; | ||||||||||||||||||||||||||||
| 1831 | |||||||||||||||||||||||||||||
| 1832 | use Venus::String; | ||||||||||||||||||||||||||||
| 1833 | |||||||||||||||||||||||||||||
| 1834 | my $string = Venus::String->new('unexplainable'); | ||||||||||||||||||||||||||||
| 1835 | |||||||||||||||||||||||||||||
| 1836 | my $index = $string->index('explain', 1); | ||||||||||||||||||||||||||||
| 1837 | |||||||||||||||||||||||||||||
| 1838 | # 2 | ||||||||||||||||||||||||||||
| 1839 | |||||||||||||||||||||||||||||
| 1840 | =back | ||||||||||||||||||||||||||||
| 1841 | |||||||||||||||||||||||||||||
| 1842 | =over 4 | ||||||||||||||||||||||||||||
| 1843 | |||||||||||||||||||||||||||||
| 1844 | =item index example 3 | ||||||||||||||||||||||||||||
| 1845 | |||||||||||||||||||||||||||||
| 1846 | package main; | ||||||||||||||||||||||||||||
| 1847 | |||||||||||||||||||||||||||||
| 1848 | use Venus::String; | ||||||||||||||||||||||||||||
| 1849 | |||||||||||||||||||||||||||||
| 1850 | my $string = Venus::String->new('unexplainable'); | ||||||||||||||||||||||||||||
| 1851 | |||||||||||||||||||||||||||||
| 1852 | my $index = $string->index('explained'); | ||||||||||||||||||||||||||||
| 1853 | |||||||||||||||||||||||||||||
| 1854 | # -1 | ||||||||||||||||||||||||||||
| 1855 | |||||||||||||||||||||||||||||
| 1856 | =back | ||||||||||||||||||||||||||||
| 1857 | |||||||||||||||||||||||||||||
| 1858 | =cut | ||||||||||||||||||||||||||||
| 1859 | |||||||||||||||||||||||||||||
| 1860 | =head2 kebabcase | ||||||||||||||||||||||||||||
| 1861 | |||||||||||||||||||||||||||||
| 1862 | kebabcase() (string) | ||||||||||||||||||||||||||||
| 1863 | |||||||||||||||||||||||||||||
| 1864 | The kebabcase method converts the string to kebabcase. | ||||||||||||||||||||||||||||
| 1865 | |||||||||||||||||||||||||||||
| 1866 | I<Since C<0.09>> | ||||||||||||||||||||||||||||
| 1867 | |||||||||||||||||||||||||||||
| 1868 | =over 4 | ||||||||||||||||||||||||||||
| 1869 | |||||||||||||||||||||||||||||
| 1870 | =item kebabcase example 1 | ||||||||||||||||||||||||||||
| 1871 | |||||||||||||||||||||||||||||
| 1872 | # given: synopsis; | ||||||||||||||||||||||||||||
| 1873 | |||||||||||||||||||||||||||||
| 1874 | my $kebabcase = $string->kebabcase; | ||||||||||||||||||||||||||||
| 1875 | |||||||||||||||||||||||||||||
| 1876 | # "hello-world" | ||||||||||||||||||||||||||||
| 1877 | |||||||||||||||||||||||||||||
| 1878 | =back | ||||||||||||||||||||||||||||
| 1879 | |||||||||||||||||||||||||||||
| 1880 | =cut | ||||||||||||||||||||||||||||
| 1881 | |||||||||||||||||||||||||||||
| 1882 | =head2 lc | ||||||||||||||||||||||||||||
| 1883 | |||||||||||||||||||||||||||||
| 1884 | lc() (string) | ||||||||||||||||||||||||||||
| 1885 | |||||||||||||||||||||||||||||
| 1886 | The lc method returns a lowercased version of the string. | ||||||||||||||||||||||||||||
| 1887 | |||||||||||||||||||||||||||||
| 1888 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 1889 | |||||||||||||||||||||||||||||
| 1890 | =over 4 | ||||||||||||||||||||||||||||
| 1891 | |||||||||||||||||||||||||||||
| 1892 | =item lc example 1 | ||||||||||||||||||||||||||||
| 1893 | |||||||||||||||||||||||||||||
| 1894 | package main; | ||||||||||||||||||||||||||||
| 1895 | |||||||||||||||||||||||||||||
| 1896 | use Venus::String; | ||||||||||||||||||||||||||||
| 1897 | |||||||||||||||||||||||||||||
| 1898 | my $string = Venus::String->new('Hello World'); | ||||||||||||||||||||||||||||
| 1899 | |||||||||||||||||||||||||||||
| 1900 | my $lc = $string->lc; | ||||||||||||||||||||||||||||
| 1901 | |||||||||||||||||||||||||||||
| 1902 | # "hello world" | ||||||||||||||||||||||||||||
| 1903 | |||||||||||||||||||||||||||||
| 1904 | =back | ||||||||||||||||||||||||||||
| 1905 | |||||||||||||||||||||||||||||
| 1906 | =cut | ||||||||||||||||||||||||||||
| 1907 | |||||||||||||||||||||||||||||
| 1908 | =head2 lcfirst | ||||||||||||||||||||||||||||
| 1909 | |||||||||||||||||||||||||||||
| 1910 | lcfirst() (string) | ||||||||||||||||||||||||||||
| 1911 | |||||||||||||||||||||||||||||
| 1912 | The lcfirst method returns a the string with the first character lowercased. | ||||||||||||||||||||||||||||
| 1913 | |||||||||||||||||||||||||||||
| 1914 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 1915 | |||||||||||||||||||||||||||||
| 1916 | =over 4 | ||||||||||||||||||||||||||||
| 1917 | |||||||||||||||||||||||||||||
| 1918 | =item lcfirst example 1 | ||||||||||||||||||||||||||||
| 1919 | |||||||||||||||||||||||||||||
| 1920 | package main; | ||||||||||||||||||||||||||||
| 1921 | |||||||||||||||||||||||||||||
| 1922 | use Venus::String; | ||||||||||||||||||||||||||||
| 1923 | |||||||||||||||||||||||||||||
| 1924 | my $string = Venus::String->new('Hello World'); | ||||||||||||||||||||||||||||
| 1925 | |||||||||||||||||||||||||||||
| 1926 | my $lcfirst = $string->lcfirst; | ||||||||||||||||||||||||||||
| 1927 | |||||||||||||||||||||||||||||
| 1928 | # "hello World" | ||||||||||||||||||||||||||||
| 1929 | |||||||||||||||||||||||||||||
| 1930 | =back | ||||||||||||||||||||||||||||
| 1931 | |||||||||||||||||||||||||||||
| 1932 | =cut | ||||||||||||||||||||||||||||
| 1933 | |||||||||||||||||||||||||||||
| 1934 | =head2 le | ||||||||||||||||||||||||||||
| 1935 | |||||||||||||||||||||||||||||
| 1936 | le(any $arg) (boolean) | ||||||||||||||||||||||||||||
| 1937 | |||||||||||||||||||||||||||||
| 1938 | The le method performs a I<"lesser-than-or-equal-to"> operation using the | ||||||||||||||||||||||||||||
| 1939 | argument provided. | ||||||||||||||||||||||||||||
| 1940 | |||||||||||||||||||||||||||||
| 1941 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 1942 | |||||||||||||||||||||||||||||
| 1943 | =over 4 | ||||||||||||||||||||||||||||
| 1944 | |||||||||||||||||||||||||||||
| 1945 | =item le example 1 | ||||||||||||||||||||||||||||
| 1946 | |||||||||||||||||||||||||||||
| 1947 | package main; | ||||||||||||||||||||||||||||
| 1948 | |||||||||||||||||||||||||||||
| 1949 | use Venus::Array; | ||||||||||||||||||||||||||||
| 1950 | use Venus::String; | ||||||||||||||||||||||||||||
| 1951 | |||||||||||||||||||||||||||||
| 1952 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1953 | my $rvalue = Venus::Array->new; | ||||||||||||||||||||||||||||
| 1954 | |||||||||||||||||||||||||||||
| 1955 | my $result = $lvalue->le($rvalue); | ||||||||||||||||||||||||||||
| 1956 | |||||||||||||||||||||||||||||
| 1957 | # 1 | ||||||||||||||||||||||||||||
| 1958 | |||||||||||||||||||||||||||||
| 1959 | =back | ||||||||||||||||||||||||||||
| 1960 | |||||||||||||||||||||||||||||
| 1961 | =over 4 | ||||||||||||||||||||||||||||
| 1962 | |||||||||||||||||||||||||||||
| 1963 | =item le example 2 | ||||||||||||||||||||||||||||
| 1964 | |||||||||||||||||||||||||||||
| 1965 | package main; | ||||||||||||||||||||||||||||
| 1966 | |||||||||||||||||||||||||||||
| 1967 | use Venus::Code; | ||||||||||||||||||||||||||||
| 1968 | use Venus::String; | ||||||||||||||||||||||||||||
| 1969 | |||||||||||||||||||||||||||||
| 1970 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1971 | my $rvalue = Venus::Code->new; | ||||||||||||||||||||||||||||
| 1972 | |||||||||||||||||||||||||||||
| 1973 | my $result = $lvalue->le($rvalue); | ||||||||||||||||||||||||||||
| 1974 | |||||||||||||||||||||||||||||
| 1975 | # 1 | ||||||||||||||||||||||||||||
| 1976 | |||||||||||||||||||||||||||||
| 1977 | =back | ||||||||||||||||||||||||||||
| 1978 | |||||||||||||||||||||||||||||
| 1979 | =over 4 | ||||||||||||||||||||||||||||
| 1980 | |||||||||||||||||||||||||||||
| 1981 | =item le example 3 | ||||||||||||||||||||||||||||
| 1982 | |||||||||||||||||||||||||||||
| 1983 | package main; | ||||||||||||||||||||||||||||
| 1984 | |||||||||||||||||||||||||||||
| 1985 | use Venus::Float; | ||||||||||||||||||||||||||||
| 1986 | use Venus::String; | ||||||||||||||||||||||||||||
| 1987 | |||||||||||||||||||||||||||||
| 1988 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 1989 | my $rvalue = Venus::Float->new; | ||||||||||||||||||||||||||||
| 1990 | |||||||||||||||||||||||||||||
| 1991 | my $result = $lvalue->le($rvalue); | ||||||||||||||||||||||||||||
| 1992 | |||||||||||||||||||||||||||||
| 1993 | # 1 | ||||||||||||||||||||||||||||
| 1994 | |||||||||||||||||||||||||||||
| 1995 | =back | ||||||||||||||||||||||||||||
| 1996 | |||||||||||||||||||||||||||||
| 1997 | =over 4 | ||||||||||||||||||||||||||||
| 1998 | |||||||||||||||||||||||||||||
| 1999 | =item le example 4 | ||||||||||||||||||||||||||||
| 2000 | |||||||||||||||||||||||||||||
| 2001 | package main; | ||||||||||||||||||||||||||||
| 2002 | |||||||||||||||||||||||||||||
| 2003 | use Venus::Hash; | ||||||||||||||||||||||||||||
| 2004 | use Venus::String; | ||||||||||||||||||||||||||||
| 2005 | |||||||||||||||||||||||||||||
| 2006 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2007 | my $rvalue = Venus::Hash->new; | ||||||||||||||||||||||||||||
| 2008 | |||||||||||||||||||||||||||||
| 2009 | my $result = $lvalue->le($rvalue); | ||||||||||||||||||||||||||||
| 2010 | |||||||||||||||||||||||||||||
| 2011 | # 1 | ||||||||||||||||||||||||||||
| 2012 | |||||||||||||||||||||||||||||
| 2013 | =back | ||||||||||||||||||||||||||||
| 2014 | |||||||||||||||||||||||||||||
| 2015 | =over 4 | ||||||||||||||||||||||||||||
| 2016 | |||||||||||||||||||||||||||||
| 2017 | =item le example 5 | ||||||||||||||||||||||||||||
| 2018 | |||||||||||||||||||||||||||||
| 2019 | package main; | ||||||||||||||||||||||||||||
| 2020 | |||||||||||||||||||||||||||||
| 2021 | use Venus::Number; | ||||||||||||||||||||||||||||
| 2022 | use Venus::String; | ||||||||||||||||||||||||||||
| 2023 | |||||||||||||||||||||||||||||
| 2024 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2025 | my $rvalue = Venus::Number->new; | ||||||||||||||||||||||||||||
| 2026 | |||||||||||||||||||||||||||||
| 2027 | my $result = $lvalue->le($rvalue); | ||||||||||||||||||||||||||||
| 2028 | |||||||||||||||||||||||||||||
| 2029 | # 1 | ||||||||||||||||||||||||||||
| 2030 | |||||||||||||||||||||||||||||
| 2031 | =back | ||||||||||||||||||||||||||||
| 2032 | |||||||||||||||||||||||||||||
| 2033 | =over 4 | ||||||||||||||||||||||||||||
| 2034 | |||||||||||||||||||||||||||||
| 2035 | =item le example 6 | ||||||||||||||||||||||||||||
| 2036 | |||||||||||||||||||||||||||||
| 2037 | package main; | ||||||||||||||||||||||||||||
| 2038 | |||||||||||||||||||||||||||||
| 2039 | use Venus::Regexp; | ||||||||||||||||||||||||||||
| 2040 | use Venus::String; | ||||||||||||||||||||||||||||
| 2041 | |||||||||||||||||||||||||||||
| 2042 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2043 | my $rvalue = Venus::Regexp->new; | ||||||||||||||||||||||||||||
| 2044 | |||||||||||||||||||||||||||||
| 2045 | my $result = $lvalue->le($rvalue); | ||||||||||||||||||||||||||||
| 2046 | |||||||||||||||||||||||||||||
| 2047 | # 1 | ||||||||||||||||||||||||||||
| 2048 | |||||||||||||||||||||||||||||
| 2049 | =back | ||||||||||||||||||||||||||||
| 2050 | |||||||||||||||||||||||||||||
| 2051 | =over 4 | ||||||||||||||||||||||||||||
| 2052 | |||||||||||||||||||||||||||||
| 2053 | =item le example 7 | ||||||||||||||||||||||||||||
| 2054 | |||||||||||||||||||||||||||||
| 2055 | package main; | ||||||||||||||||||||||||||||
| 2056 | |||||||||||||||||||||||||||||
| 2057 | use Venus::Scalar; | ||||||||||||||||||||||||||||
| 2058 | use Venus::String; | ||||||||||||||||||||||||||||
| 2059 | |||||||||||||||||||||||||||||
| 2060 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2061 | my $rvalue = Venus::Scalar->new; | ||||||||||||||||||||||||||||
| 2062 | |||||||||||||||||||||||||||||
| 2063 | my $result = $lvalue->le($rvalue); | ||||||||||||||||||||||||||||
| 2064 | |||||||||||||||||||||||||||||
| 2065 | # 1 | ||||||||||||||||||||||||||||
| 2066 | |||||||||||||||||||||||||||||
| 2067 | =back | ||||||||||||||||||||||||||||
| 2068 | |||||||||||||||||||||||||||||
| 2069 | =over 4 | ||||||||||||||||||||||||||||
| 2070 | |||||||||||||||||||||||||||||
| 2071 | =item le example 8 | ||||||||||||||||||||||||||||
| 2072 | |||||||||||||||||||||||||||||
| 2073 | package main; | ||||||||||||||||||||||||||||
| 2074 | |||||||||||||||||||||||||||||
| 2075 | use Venus::String; | ||||||||||||||||||||||||||||
| 2076 | |||||||||||||||||||||||||||||
| 2077 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2078 | my $rvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2079 | |||||||||||||||||||||||||||||
| 2080 | my $result = $lvalue->le($rvalue); | ||||||||||||||||||||||||||||
| 2081 | |||||||||||||||||||||||||||||
| 2082 | # 1 | ||||||||||||||||||||||||||||
| 2083 | |||||||||||||||||||||||||||||
| 2084 | =back | ||||||||||||||||||||||||||||
| 2085 | |||||||||||||||||||||||||||||
| 2086 | =over 4 | ||||||||||||||||||||||||||||
| 2087 | |||||||||||||||||||||||||||||
| 2088 | =item le example 9 | ||||||||||||||||||||||||||||
| 2089 | |||||||||||||||||||||||||||||
| 2090 | package main; | ||||||||||||||||||||||||||||
| 2091 | |||||||||||||||||||||||||||||
| 2092 | use Venus::String; | ||||||||||||||||||||||||||||
| 2093 | use Venus::Undef; | ||||||||||||||||||||||||||||
| 2094 | |||||||||||||||||||||||||||||
| 2095 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2096 | my $rvalue = Venus::Undef->new; | ||||||||||||||||||||||||||||
| 2097 | |||||||||||||||||||||||||||||
| 2098 | my $result = $lvalue->le($rvalue); | ||||||||||||||||||||||||||||
| 2099 | |||||||||||||||||||||||||||||
| 2100 | # 1 | ||||||||||||||||||||||||||||
| 2101 | |||||||||||||||||||||||||||||
| 2102 | =back | ||||||||||||||||||||||||||||
| 2103 | |||||||||||||||||||||||||||||
| 2104 | =cut | ||||||||||||||||||||||||||||
| 2105 | |||||||||||||||||||||||||||||
| 2106 | =head2 length | ||||||||||||||||||||||||||||
| 2107 | |||||||||||||||||||||||||||||
| 2108 | length() (number) | ||||||||||||||||||||||||||||
| 2109 | |||||||||||||||||||||||||||||
| 2110 | The length method returns the number of characters within the string. | ||||||||||||||||||||||||||||
| 2111 | |||||||||||||||||||||||||||||
| 2112 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2113 | |||||||||||||||||||||||||||||
| 2114 | =over 4 | ||||||||||||||||||||||||||||
| 2115 | |||||||||||||||||||||||||||||
| 2116 | =item length example 1 | ||||||||||||||||||||||||||||
| 2117 | |||||||||||||||||||||||||||||
| 2118 | # given: synopsis; | ||||||||||||||||||||||||||||
| 2119 | |||||||||||||||||||||||||||||
| 2120 | my $length = $string->length; | ||||||||||||||||||||||||||||
| 2121 | |||||||||||||||||||||||||||||
| 2122 | # 11 | ||||||||||||||||||||||||||||
| 2123 | |||||||||||||||||||||||||||||
| 2124 | =back | ||||||||||||||||||||||||||||
| 2125 | |||||||||||||||||||||||||||||
| 2126 | =cut | ||||||||||||||||||||||||||||
| 2127 | |||||||||||||||||||||||||||||
| 2128 | =head2 lines | ||||||||||||||||||||||||||||
| 2129 | |||||||||||||||||||||||||||||
| 2130 | lines() (within[arrayref, string]) | ||||||||||||||||||||||||||||
| 2131 | |||||||||||||||||||||||||||||
| 2132 | The lines method returns an arrayref of parts by splitting on 1 or more newline | ||||||||||||||||||||||||||||
| 2133 | characters. | ||||||||||||||||||||||||||||
| 2134 | |||||||||||||||||||||||||||||
| 2135 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2136 | |||||||||||||||||||||||||||||
| 2137 | =over 4 | ||||||||||||||||||||||||||||
| 2138 | |||||||||||||||||||||||||||||
| 2139 | =item lines example 1 | ||||||||||||||||||||||||||||
| 2140 | |||||||||||||||||||||||||||||
| 2141 | # given: synopsis; | ||||||||||||||||||||||||||||
| 2142 | |||||||||||||||||||||||||||||
| 2143 | my $lines = $string->lines; | ||||||||||||||||||||||||||||
| 2144 | |||||||||||||||||||||||||||||
| 2145 | # ["hello world"] | ||||||||||||||||||||||||||||
| 2146 | |||||||||||||||||||||||||||||
| 2147 | =back | ||||||||||||||||||||||||||||
| 2148 | |||||||||||||||||||||||||||||
| 2149 | =over 4 | ||||||||||||||||||||||||||||
| 2150 | |||||||||||||||||||||||||||||
| 2151 | =item lines example 2 | ||||||||||||||||||||||||||||
| 2152 | |||||||||||||||||||||||||||||
| 2153 | package main; | ||||||||||||||||||||||||||||
| 2154 | |||||||||||||||||||||||||||||
| 2155 | use Venus::String; | ||||||||||||||||||||||||||||
| 2156 | |||||||||||||||||||||||||||||
| 2157 | my $string = Venus::String->new("who am i?\nwhere am i?\nhow did I get here"); | ||||||||||||||||||||||||||||
| 2158 | |||||||||||||||||||||||||||||
| 2159 | my $lines = $string->lines; | ||||||||||||||||||||||||||||
| 2160 | |||||||||||||||||||||||||||||
| 2161 | # ["who am i?", "where am i?", "how did I get here"] | ||||||||||||||||||||||||||||
| 2162 | |||||||||||||||||||||||||||||
| 2163 | =back | ||||||||||||||||||||||||||||
| 2164 | |||||||||||||||||||||||||||||
| 2165 | =cut | ||||||||||||||||||||||||||||
| 2166 | |||||||||||||||||||||||||||||
| 2167 | =head2 lowercase | ||||||||||||||||||||||||||||
| 2168 | |||||||||||||||||||||||||||||
| 2169 | lowercase() (string) | ||||||||||||||||||||||||||||
| 2170 | |||||||||||||||||||||||||||||
| 2171 | The lowercase method is an alias to the lc method. | ||||||||||||||||||||||||||||
| 2172 | |||||||||||||||||||||||||||||
| 2173 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2174 | |||||||||||||||||||||||||||||
| 2175 | =over 4 | ||||||||||||||||||||||||||||
| 2176 | |||||||||||||||||||||||||||||
| 2177 | =item lowercase example 1 | ||||||||||||||||||||||||||||
| 2178 | |||||||||||||||||||||||||||||
| 2179 | package main; | ||||||||||||||||||||||||||||
| 2180 | |||||||||||||||||||||||||||||
| 2181 | use Venus::String; | ||||||||||||||||||||||||||||
| 2182 | |||||||||||||||||||||||||||||
| 2183 | my $string = Venus::String->new('Hello World'); | ||||||||||||||||||||||||||||
| 2184 | |||||||||||||||||||||||||||||
| 2185 | my $lowercase = $string->lowercase; | ||||||||||||||||||||||||||||
| 2186 | |||||||||||||||||||||||||||||
| 2187 | # "hello world" | ||||||||||||||||||||||||||||
| 2188 | |||||||||||||||||||||||||||||
| 2189 | =back | ||||||||||||||||||||||||||||
| 2190 | |||||||||||||||||||||||||||||
| 2191 | =cut | ||||||||||||||||||||||||||||
| 2192 | |||||||||||||||||||||||||||||
| 2193 | =head2 lt | ||||||||||||||||||||||||||||
| 2194 | |||||||||||||||||||||||||||||
| 2195 | lt(any $arg) (boolean) | ||||||||||||||||||||||||||||
| 2196 | |||||||||||||||||||||||||||||
| 2197 | The lt method performs a I<"lesser-than"> operation using the argument provided. | ||||||||||||||||||||||||||||
| 2198 | |||||||||||||||||||||||||||||
| 2199 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 2200 | |||||||||||||||||||||||||||||
| 2201 | =over 4 | ||||||||||||||||||||||||||||
| 2202 | |||||||||||||||||||||||||||||
| 2203 | =item lt example 1 | ||||||||||||||||||||||||||||
| 2204 | |||||||||||||||||||||||||||||
| 2205 | package main; | ||||||||||||||||||||||||||||
| 2206 | |||||||||||||||||||||||||||||
| 2207 | use Venus::Array; | ||||||||||||||||||||||||||||
| 2208 | use Venus::String; | ||||||||||||||||||||||||||||
| 2209 | |||||||||||||||||||||||||||||
| 2210 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2211 | my $rvalue = Venus::Array->new; | ||||||||||||||||||||||||||||
| 2212 | |||||||||||||||||||||||||||||
| 2213 | my $result = $lvalue->lt($rvalue); | ||||||||||||||||||||||||||||
| 2214 | |||||||||||||||||||||||||||||
| 2215 | # 1 | ||||||||||||||||||||||||||||
| 2216 | |||||||||||||||||||||||||||||
| 2217 | =back | ||||||||||||||||||||||||||||
| 2218 | |||||||||||||||||||||||||||||
| 2219 | =over 4 | ||||||||||||||||||||||||||||
| 2220 | |||||||||||||||||||||||||||||
| 2221 | =item lt example 2 | ||||||||||||||||||||||||||||
| 2222 | |||||||||||||||||||||||||||||
| 2223 | package main; | ||||||||||||||||||||||||||||
| 2224 | |||||||||||||||||||||||||||||
| 2225 | use Venus::Code; | ||||||||||||||||||||||||||||
| 2226 | use Venus::String; | ||||||||||||||||||||||||||||
| 2227 | |||||||||||||||||||||||||||||
| 2228 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2229 | my $rvalue = Venus::Code->new; | ||||||||||||||||||||||||||||
| 2230 | |||||||||||||||||||||||||||||
| 2231 | my $result = $lvalue->lt($rvalue); | ||||||||||||||||||||||||||||
| 2232 | |||||||||||||||||||||||||||||
| 2233 | # 1 | ||||||||||||||||||||||||||||
| 2234 | |||||||||||||||||||||||||||||
| 2235 | =back | ||||||||||||||||||||||||||||
| 2236 | |||||||||||||||||||||||||||||
| 2237 | =over 4 | ||||||||||||||||||||||||||||
| 2238 | |||||||||||||||||||||||||||||
| 2239 | =item lt example 3 | ||||||||||||||||||||||||||||
| 2240 | |||||||||||||||||||||||||||||
| 2241 | package main; | ||||||||||||||||||||||||||||
| 2242 | |||||||||||||||||||||||||||||
| 2243 | use Venus::Float; | ||||||||||||||||||||||||||||
| 2244 | use Venus::String; | ||||||||||||||||||||||||||||
| 2245 | |||||||||||||||||||||||||||||
| 2246 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2247 | my $rvalue = Venus::Float->new; | ||||||||||||||||||||||||||||
| 2248 | |||||||||||||||||||||||||||||
| 2249 | my $result = $lvalue->lt($rvalue); | ||||||||||||||||||||||||||||
| 2250 | |||||||||||||||||||||||||||||
| 2251 | # 1 | ||||||||||||||||||||||||||||
| 2252 | |||||||||||||||||||||||||||||
| 2253 | =back | ||||||||||||||||||||||||||||
| 2254 | |||||||||||||||||||||||||||||
| 2255 | =over 4 | ||||||||||||||||||||||||||||
| 2256 | |||||||||||||||||||||||||||||
| 2257 | =item lt example 4 | ||||||||||||||||||||||||||||
| 2258 | |||||||||||||||||||||||||||||
| 2259 | package main; | ||||||||||||||||||||||||||||
| 2260 | |||||||||||||||||||||||||||||
| 2261 | use Venus::Hash; | ||||||||||||||||||||||||||||
| 2262 | use Venus::String; | ||||||||||||||||||||||||||||
| 2263 | |||||||||||||||||||||||||||||
| 2264 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2265 | my $rvalue = Venus::Hash->new; | ||||||||||||||||||||||||||||
| 2266 | |||||||||||||||||||||||||||||
| 2267 | my $result = $lvalue->lt($rvalue); | ||||||||||||||||||||||||||||
| 2268 | |||||||||||||||||||||||||||||
| 2269 | # 1 | ||||||||||||||||||||||||||||
| 2270 | |||||||||||||||||||||||||||||
| 2271 | =back | ||||||||||||||||||||||||||||
| 2272 | |||||||||||||||||||||||||||||
| 2273 | =over 4 | ||||||||||||||||||||||||||||
| 2274 | |||||||||||||||||||||||||||||
| 2275 | =item lt example 5 | ||||||||||||||||||||||||||||
| 2276 | |||||||||||||||||||||||||||||
| 2277 | package main; | ||||||||||||||||||||||||||||
| 2278 | |||||||||||||||||||||||||||||
| 2279 | use Venus::Number; | ||||||||||||||||||||||||||||
| 2280 | use Venus::String; | ||||||||||||||||||||||||||||
| 2281 | |||||||||||||||||||||||||||||
| 2282 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2283 | my $rvalue = Venus::Number->new; | ||||||||||||||||||||||||||||
| 2284 | |||||||||||||||||||||||||||||
| 2285 | my $result = $lvalue->lt($rvalue); | ||||||||||||||||||||||||||||
| 2286 | |||||||||||||||||||||||||||||
| 2287 | # 1 | ||||||||||||||||||||||||||||
| 2288 | |||||||||||||||||||||||||||||
| 2289 | =back | ||||||||||||||||||||||||||||
| 2290 | |||||||||||||||||||||||||||||
| 2291 | =over 4 | ||||||||||||||||||||||||||||
| 2292 | |||||||||||||||||||||||||||||
| 2293 | =item lt example 6 | ||||||||||||||||||||||||||||
| 2294 | |||||||||||||||||||||||||||||
| 2295 | package main; | ||||||||||||||||||||||||||||
| 2296 | |||||||||||||||||||||||||||||
| 2297 | use Venus::Regexp; | ||||||||||||||||||||||||||||
| 2298 | use Venus::String; | ||||||||||||||||||||||||||||
| 2299 | |||||||||||||||||||||||||||||
| 2300 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2301 | my $rvalue = Venus::Regexp->new; | ||||||||||||||||||||||||||||
| 2302 | |||||||||||||||||||||||||||||
| 2303 | my $result = $lvalue->lt($rvalue); | ||||||||||||||||||||||||||||
| 2304 | |||||||||||||||||||||||||||||
| 2305 | # 1 | ||||||||||||||||||||||||||||
| 2306 | |||||||||||||||||||||||||||||
| 2307 | =back | ||||||||||||||||||||||||||||
| 2308 | |||||||||||||||||||||||||||||
| 2309 | =over 4 | ||||||||||||||||||||||||||||
| 2310 | |||||||||||||||||||||||||||||
| 2311 | =item lt example 7 | ||||||||||||||||||||||||||||
| 2312 | |||||||||||||||||||||||||||||
| 2313 | package main; | ||||||||||||||||||||||||||||
| 2314 | |||||||||||||||||||||||||||||
| 2315 | use Venus::Scalar; | ||||||||||||||||||||||||||||
| 2316 | use Venus::String; | ||||||||||||||||||||||||||||
| 2317 | |||||||||||||||||||||||||||||
| 2318 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2319 | my $rvalue = Venus::Scalar->new; | ||||||||||||||||||||||||||||
| 2320 | |||||||||||||||||||||||||||||
| 2321 | my $result = $lvalue->lt($rvalue); | ||||||||||||||||||||||||||||
| 2322 | |||||||||||||||||||||||||||||
| 2323 | # 1 | ||||||||||||||||||||||||||||
| 2324 | |||||||||||||||||||||||||||||
| 2325 | =back | ||||||||||||||||||||||||||||
| 2326 | |||||||||||||||||||||||||||||
| 2327 | =over 4 | ||||||||||||||||||||||||||||
| 2328 | |||||||||||||||||||||||||||||
| 2329 | =item lt example 8 | ||||||||||||||||||||||||||||
| 2330 | |||||||||||||||||||||||||||||
| 2331 | package main; | ||||||||||||||||||||||||||||
| 2332 | |||||||||||||||||||||||||||||
| 2333 | use Venus::String; | ||||||||||||||||||||||||||||
| 2334 | |||||||||||||||||||||||||||||
| 2335 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2336 | my $rvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2337 | |||||||||||||||||||||||||||||
| 2338 | my $result = $lvalue->lt($rvalue); | ||||||||||||||||||||||||||||
| 2339 | |||||||||||||||||||||||||||||
| 2340 | # 0 | ||||||||||||||||||||||||||||
| 2341 | |||||||||||||||||||||||||||||
| 2342 | =back | ||||||||||||||||||||||||||||
| 2343 | |||||||||||||||||||||||||||||
| 2344 | =over 4 | ||||||||||||||||||||||||||||
| 2345 | |||||||||||||||||||||||||||||
| 2346 | =item lt example 9 | ||||||||||||||||||||||||||||
| 2347 | |||||||||||||||||||||||||||||
| 2348 | package main; | ||||||||||||||||||||||||||||
| 2349 | |||||||||||||||||||||||||||||
| 2350 | use Venus::String; | ||||||||||||||||||||||||||||
| 2351 | use Venus::Undef; | ||||||||||||||||||||||||||||
| 2352 | |||||||||||||||||||||||||||||
| 2353 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2354 | my $rvalue = Venus::Undef->new; | ||||||||||||||||||||||||||||
| 2355 | |||||||||||||||||||||||||||||
| 2356 | my $result = $lvalue->lt($rvalue); | ||||||||||||||||||||||||||||
| 2357 | |||||||||||||||||||||||||||||
| 2358 | # 0 | ||||||||||||||||||||||||||||
| 2359 | |||||||||||||||||||||||||||||
| 2360 | =back | ||||||||||||||||||||||||||||
| 2361 | |||||||||||||||||||||||||||||
| 2362 | =cut | ||||||||||||||||||||||||||||
| 2363 | |||||||||||||||||||||||||||||
| 2364 | =head2 ne | ||||||||||||||||||||||||||||
| 2365 | |||||||||||||||||||||||||||||
| 2366 | ne(any $arg) (boolean) | ||||||||||||||||||||||||||||
| 2367 | |||||||||||||||||||||||||||||
| 2368 | The ne method performs a I<"not-equal-to"> operation using the argument provided. | ||||||||||||||||||||||||||||
| 2369 | |||||||||||||||||||||||||||||
| 2370 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 2371 | |||||||||||||||||||||||||||||
| 2372 | =over 4 | ||||||||||||||||||||||||||||
| 2373 | |||||||||||||||||||||||||||||
| 2374 | =item ne example 1 | ||||||||||||||||||||||||||||
| 2375 | |||||||||||||||||||||||||||||
| 2376 | package main; | ||||||||||||||||||||||||||||
| 2377 | |||||||||||||||||||||||||||||
| 2378 | use Venus::Array; | ||||||||||||||||||||||||||||
| 2379 | use Venus::String; | ||||||||||||||||||||||||||||
| 2380 | |||||||||||||||||||||||||||||
| 2381 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2382 | my $rvalue = Venus::Array->new; | ||||||||||||||||||||||||||||
| 2383 | |||||||||||||||||||||||||||||
| 2384 | my $result = $lvalue->ne($rvalue); | ||||||||||||||||||||||||||||
| 2385 | |||||||||||||||||||||||||||||
| 2386 | # 1 | ||||||||||||||||||||||||||||
| 2387 | |||||||||||||||||||||||||||||
| 2388 | =back | ||||||||||||||||||||||||||||
| 2389 | |||||||||||||||||||||||||||||
| 2390 | =over 4 | ||||||||||||||||||||||||||||
| 2391 | |||||||||||||||||||||||||||||
| 2392 | =item ne example 2 | ||||||||||||||||||||||||||||
| 2393 | |||||||||||||||||||||||||||||
| 2394 | package main; | ||||||||||||||||||||||||||||
| 2395 | |||||||||||||||||||||||||||||
| 2396 | use Venus::Code; | ||||||||||||||||||||||||||||
| 2397 | use Venus::String; | ||||||||||||||||||||||||||||
| 2398 | |||||||||||||||||||||||||||||
| 2399 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2400 | my $rvalue = Venus::Code->new; | ||||||||||||||||||||||||||||
| 2401 | |||||||||||||||||||||||||||||
| 2402 | my $result = $lvalue->ne($rvalue); | ||||||||||||||||||||||||||||
| 2403 | |||||||||||||||||||||||||||||
| 2404 | # 1 | ||||||||||||||||||||||||||||
| 2405 | |||||||||||||||||||||||||||||
| 2406 | =back | ||||||||||||||||||||||||||||
| 2407 | |||||||||||||||||||||||||||||
| 2408 | =over 4 | ||||||||||||||||||||||||||||
| 2409 | |||||||||||||||||||||||||||||
| 2410 | =item ne example 3 | ||||||||||||||||||||||||||||
| 2411 | |||||||||||||||||||||||||||||
| 2412 | package main; | ||||||||||||||||||||||||||||
| 2413 | |||||||||||||||||||||||||||||
| 2414 | use Venus::Float; | ||||||||||||||||||||||||||||
| 2415 | use Venus::String; | ||||||||||||||||||||||||||||
| 2416 | |||||||||||||||||||||||||||||
| 2417 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2418 | my $rvalue = Venus::Float->new; | ||||||||||||||||||||||||||||
| 2419 | |||||||||||||||||||||||||||||
| 2420 | my $result = $lvalue->ne($rvalue); | ||||||||||||||||||||||||||||
| 2421 | |||||||||||||||||||||||||||||
| 2422 | # 1 | ||||||||||||||||||||||||||||
| 2423 | |||||||||||||||||||||||||||||
| 2424 | =back | ||||||||||||||||||||||||||||
| 2425 | |||||||||||||||||||||||||||||
| 2426 | =over 4 | ||||||||||||||||||||||||||||
| 2427 | |||||||||||||||||||||||||||||
| 2428 | =item ne example 4 | ||||||||||||||||||||||||||||
| 2429 | |||||||||||||||||||||||||||||
| 2430 | package main; | ||||||||||||||||||||||||||||
| 2431 | |||||||||||||||||||||||||||||
| 2432 | use Venus::Hash; | ||||||||||||||||||||||||||||
| 2433 | use Venus::String; | ||||||||||||||||||||||||||||
| 2434 | |||||||||||||||||||||||||||||
| 2435 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2436 | my $rvalue = Venus::Hash->new; | ||||||||||||||||||||||||||||
| 2437 | |||||||||||||||||||||||||||||
| 2438 | my $result = $lvalue->ne($rvalue); | ||||||||||||||||||||||||||||
| 2439 | |||||||||||||||||||||||||||||
| 2440 | # 1 | ||||||||||||||||||||||||||||
| 2441 | |||||||||||||||||||||||||||||
| 2442 | =back | ||||||||||||||||||||||||||||
| 2443 | |||||||||||||||||||||||||||||
| 2444 | =over 4 | ||||||||||||||||||||||||||||
| 2445 | |||||||||||||||||||||||||||||
| 2446 | =item ne example 5 | ||||||||||||||||||||||||||||
| 2447 | |||||||||||||||||||||||||||||
| 2448 | package main; | ||||||||||||||||||||||||||||
| 2449 | |||||||||||||||||||||||||||||
| 2450 | use Venus::Number; | ||||||||||||||||||||||||||||
| 2451 | use Venus::String; | ||||||||||||||||||||||||||||
| 2452 | |||||||||||||||||||||||||||||
| 2453 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2454 | my $rvalue = Venus::Number->new; | ||||||||||||||||||||||||||||
| 2455 | |||||||||||||||||||||||||||||
| 2456 | my $result = $lvalue->ne($rvalue); | ||||||||||||||||||||||||||||
| 2457 | |||||||||||||||||||||||||||||
| 2458 | # 1 | ||||||||||||||||||||||||||||
| 2459 | |||||||||||||||||||||||||||||
| 2460 | =back | ||||||||||||||||||||||||||||
| 2461 | |||||||||||||||||||||||||||||
| 2462 | =over 4 | ||||||||||||||||||||||||||||
| 2463 | |||||||||||||||||||||||||||||
| 2464 | =item ne example 6 | ||||||||||||||||||||||||||||
| 2465 | |||||||||||||||||||||||||||||
| 2466 | package main; | ||||||||||||||||||||||||||||
| 2467 | |||||||||||||||||||||||||||||
| 2468 | use Venus::Regexp; | ||||||||||||||||||||||||||||
| 2469 | use Venus::String; | ||||||||||||||||||||||||||||
| 2470 | |||||||||||||||||||||||||||||
| 2471 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2472 | my $rvalue = Venus::Regexp->new; | ||||||||||||||||||||||||||||
| 2473 | |||||||||||||||||||||||||||||
| 2474 | my $result = $lvalue->ne($rvalue); | ||||||||||||||||||||||||||||
| 2475 | |||||||||||||||||||||||||||||
| 2476 | # 1 | ||||||||||||||||||||||||||||
| 2477 | |||||||||||||||||||||||||||||
| 2478 | =back | ||||||||||||||||||||||||||||
| 2479 | |||||||||||||||||||||||||||||
| 2480 | =over 4 | ||||||||||||||||||||||||||||
| 2481 | |||||||||||||||||||||||||||||
| 2482 | =item ne example 7 | ||||||||||||||||||||||||||||
| 2483 | |||||||||||||||||||||||||||||
| 2484 | package main; | ||||||||||||||||||||||||||||
| 2485 | |||||||||||||||||||||||||||||
| 2486 | use Venus::Scalar; | ||||||||||||||||||||||||||||
| 2487 | use Venus::String; | ||||||||||||||||||||||||||||
| 2488 | |||||||||||||||||||||||||||||
| 2489 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2490 | my $rvalue = Venus::Scalar->new; | ||||||||||||||||||||||||||||
| 2491 | |||||||||||||||||||||||||||||
| 2492 | my $result = $lvalue->ne($rvalue); | ||||||||||||||||||||||||||||
| 2493 | |||||||||||||||||||||||||||||
| 2494 | # 1 | ||||||||||||||||||||||||||||
| 2495 | |||||||||||||||||||||||||||||
| 2496 | =back | ||||||||||||||||||||||||||||
| 2497 | |||||||||||||||||||||||||||||
| 2498 | =over 4 | ||||||||||||||||||||||||||||
| 2499 | |||||||||||||||||||||||||||||
| 2500 | =item ne example 8 | ||||||||||||||||||||||||||||
| 2501 | |||||||||||||||||||||||||||||
| 2502 | package main; | ||||||||||||||||||||||||||||
| 2503 | |||||||||||||||||||||||||||||
| 2504 | use Venus::String; | ||||||||||||||||||||||||||||
| 2505 | |||||||||||||||||||||||||||||
| 2506 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2507 | my $rvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2508 | |||||||||||||||||||||||||||||
| 2509 | my $result = $lvalue->ne($rvalue); | ||||||||||||||||||||||||||||
| 2510 | |||||||||||||||||||||||||||||
| 2511 | # 0 | ||||||||||||||||||||||||||||
| 2512 | |||||||||||||||||||||||||||||
| 2513 | =back | ||||||||||||||||||||||||||||
| 2514 | |||||||||||||||||||||||||||||
| 2515 | =over 4 | ||||||||||||||||||||||||||||
| 2516 | |||||||||||||||||||||||||||||
| 2517 | =item ne example 9 | ||||||||||||||||||||||||||||
| 2518 | |||||||||||||||||||||||||||||
| 2519 | package main; | ||||||||||||||||||||||||||||
| 2520 | |||||||||||||||||||||||||||||
| 2521 | use Venus::String; | ||||||||||||||||||||||||||||
| 2522 | use Venus::Undef; | ||||||||||||||||||||||||||||
| 2523 | |||||||||||||||||||||||||||||
| 2524 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 2525 | my $rvalue = Venus::Undef->new; | ||||||||||||||||||||||||||||
| 2526 | |||||||||||||||||||||||||||||
| 2527 | my $result = $lvalue->ne($rvalue); | ||||||||||||||||||||||||||||
| 2528 | |||||||||||||||||||||||||||||
| 2529 | # 0 | ||||||||||||||||||||||||||||
| 2530 | |||||||||||||||||||||||||||||
| 2531 | =back | ||||||||||||||||||||||||||||
| 2532 | |||||||||||||||||||||||||||||
| 2533 | =cut | ||||||||||||||||||||||||||||
| 2534 | |||||||||||||||||||||||||||||
| 2535 | =head2 numified | ||||||||||||||||||||||||||||
| 2536 | |||||||||||||||||||||||||||||
| 2537 | numified() (number) | ||||||||||||||||||||||||||||
| 2538 | |||||||||||||||||||||||||||||
| 2539 | The numified method returns the numerical representation of the object. For | ||||||||||||||||||||||||||||
| 2540 | string objects this method returns the underlying value, if that value looks | ||||||||||||||||||||||||||||
| 2541 | like a number, or C<0>. | ||||||||||||||||||||||||||||
| 2542 | |||||||||||||||||||||||||||||
| 2543 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 2544 | |||||||||||||||||||||||||||||
| 2545 | =over 4 | ||||||||||||||||||||||||||||
| 2546 | |||||||||||||||||||||||||||||
| 2547 | =item numified example 1 | ||||||||||||||||||||||||||||
| 2548 | |||||||||||||||||||||||||||||
| 2549 | # given: synopsis; | ||||||||||||||||||||||||||||
| 2550 | |||||||||||||||||||||||||||||
| 2551 | my $numified = $string->numified; | ||||||||||||||||||||||||||||
| 2552 | |||||||||||||||||||||||||||||
| 2553 | # 11 | ||||||||||||||||||||||||||||
| 2554 | |||||||||||||||||||||||||||||
| 2555 | =back | ||||||||||||||||||||||||||||
| 2556 | |||||||||||||||||||||||||||||
| 2557 | =over 4 | ||||||||||||||||||||||||||||
| 2558 | |||||||||||||||||||||||||||||
| 2559 | =item numified example 2 | ||||||||||||||||||||||||||||
| 2560 | |||||||||||||||||||||||||||||
| 2561 | package main; | ||||||||||||||||||||||||||||
| 2562 | |||||||||||||||||||||||||||||
| 2563 | use Venus::String; | ||||||||||||||||||||||||||||
| 2564 | |||||||||||||||||||||||||||||
| 2565 | my $string = Venus::String->new(1_000_000); | ||||||||||||||||||||||||||||
| 2566 | |||||||||||||||||||||||||||||
| 2567 | my $numified = $string->numified; | ||||||||||||||||||||||||||||
| 2568 | |||||||||||||||||||||||||||||
| 2569 | # 1000000 | ||||||||||||||||||||||||||||
| 2570 | |||||||||||||||||||||||||||||
| 2571 | =back | ||||||||||||||||||||||||||||
| 2572 | |||||||||||||||||||||||||||||
| 2573 | =cut | ||||||||||||||||||||||||||||
| 2574 | |||||||||||||||||||||||||||||
| 2575 | =head2 pascalcase | ||||||||||||||||||||||||||||
| 2576 | |||||||||||||||||||||||||||||
| 2577 | pascalcase() (string) | ||||||||||||||||||||||||||||
| 2578 | |||||||||||||||||||||||||||||
| 2579 | The pascalcase method converts the string to pascalcase. | ||||||||||||||||||||||||||||
| 2580 | |||||||||||||||||||||||||||||
| 2581 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2582 | |||||||||||||||||||||||||||||
| 2583 | =over 4 | ||||||||||||||||||||||||||||
| 2584 | |||||||||||||||||||||||||||||
| 2585 | =item pascalcase example 1 | ||||||||||||||||||||||||||||
| 2586 | |||||||||||||||||||||||||||||
| 2587 | # given: synopsis; | ||||||||||||||||||||||||||||
| 2588 | |||||||||||||||||||||||||||||
| 2589 | my $pascalcase = $string->pascalcase; | ||||||||||||||||||||||||||||
| 2590 | |||||||||||||||||||||||||||||
| 2591 | # "HelloWorld" | ||||||||||||||||||||||||||||
| 2592 | |||||||||||||||||||||||||||||
| 2593 | =back | ||||||||||||||||||||||||||||
| 2594 | |||||||||||||||||||||||||||||
| 2595 | =cut | ||||||||||||||||||||||||||||
| 2596 | |||||||||||||||||||||||||||||
| 2597 | =head2 prepend | ||||||||||||||||||||||||||||
| 2598 | |||||||||||||||||||||||||||||
| 2599 | prepend(string @parts) (string) | ||||||||||||||||||||||||||||
| 2600 | |||||||||||||||||||||||||||||
| 2601 | The prepend method prepends arugments to the string using spaces. | ||||||||||||||||||||||||||||
| 2602 | |||||||||||||||||||||||||||||
| 2603 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2604 | |||||||||||||||||||||||||||||
| 2605 | =over 4 | ||||||||||||||||||||||||||||
| 2606 | |||||||||||||||||||||||||||||
| 2607 | =item prepend example 1 | ||||||||||||||||||||||||||||
| 2608 | |||||||||||||||||||||||||||||
| 2609 | # given: synopsis; | ||||||||||||||||||||||||||||
| 2610 | |||||||||||||||||||||||||||||
| 2611 | my $prepend = $string->prepend('welcome'); | ||||||||||||||||||||||||||||
| 2612 | |||||||||||||||||||||||||||||
| 2613 | # "welcome hello world" | ||||||||||||||||||||||||||||
| 2614 | |||||||||||||||||||||||||||||
| 2615 | =back | ||||||||||||||||||||||||||||
| 2616 | |||||||||||||||||||||||||||||
| 2617 | =cut | ||||||||||||||||||||||||||||
| 2618 | |||||||||||||||||||||||||||||
| 2619 | =head2 prepend_with | ||||||||||||||||||||||||||||
| 2620 | |||||||||||||||||||||||||||||
| 2621 | prepend_with(string $delimiter, string @parts) (string) | ||||||||||||||||||||||||||||
| 2622 | |||||||||||||||||||||||||||||
| 2623 | The prepend_with method prepends arugments to the string using the delimiter | ||||||||||||||||||||||||||||
| 2624 | provided. | ||||||||||||||||||||||||||||
| 2625 | |||||||||||||||||||||||||||||
| 2626 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2627 | |||||||||||||||||||||||||||||
| 2628 | =over 4 | ||||||||||||||||||||||||||||
| 2629 | |||||||||||||||||||||||||||||
| 2630 | =item prepend_with example 1 | ||||||||||||||||||||||||||||
| 2631 | |||||||||||||||||||||||||||||
| 2632 | # given: synopsis; | ||||||||||||||||||||||||||||
| 2633 | |||||||||||||||||||||||||||||
| 2634 | my $prepend = $string->prepend_with(', ', 'welcome'); | ||||||||||||||||||||||||||||
| 2635 | |||||||||||||||||||||||||||||
| 2636 | # "welcome, hello world" | ||||||||||||||||||||||||||||
| 2637 | |||||||||||||||||||||||||||||
| 2638 | =back | ||||||||||||||||||||||||||||
| 2639 | |||||||||||||||||||||||||||||
| 2640 | =cut | ||||||||||||||||||||||||||||
| 2641 | |||||||||||||||||||||||||||||
| 2642 | =head2 render | ||||||||||||||||||||||||||||
| 2643 | |||||||||||||||||||||||||||||
| 2644 | render(hashref $tokens) (string) | ||||||||||||||||||||||||||||
| 2645 | |||||||||||||||||||||||||||||
| 2646 | The render method treats the string as a template and performs a simple token | ||||||||||||||||||||||||||||
| 2647 | replacement using the argument provided. | ||||||||||||||||||||||||||||
| 2648 | |||||||||||||||||||||||||||||
| 2649 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2650 | |||||||||||||||||||||||||||||
| 2651 | =over 4 | ||||||||||||||||||||||||||||
| 2652 | |||||||||||||||||||||||||||||
| 2653 | =item render example 1 | ||||||||||||||||||||||||||||
| 2654 | |||||||||||||||||||||||||||||
| 2655 | package main; | ||||||||||||||||||||||||||||
| 2656 | |||||||||||||||||||||||||||||
| 2657 | use Venus::String; | ||||||||||||||||||||||||||||
| 2658 | |||||||||||||||||||||||||||||
| 2659 | my $string = Venus::String->new('Hi, {{name}}!'); | ||||||||||||||||||||||||||||
| 2660 | |||||||||||||||||||||||||||||
| 2661 | my $render = $string->render({name => 'Friend'}); | ||||||||||||||||||||||||||||
| 2662 | |||||||||||||||||||||||||||||
| 2663 | # "Hi, Friend!" | ||||||||||||||||||||||||||||
| 2664 | |||||||||||||||||||||||||||||
| 2665 | =back | ||||||||||||||||||||||||||||
| 2666 | |||||||||||||||||||||||||||||
| 2667 | =cut | ||||||||||||||||||||||||||||
| 2668 | |||||||||||||||||||||||||||||
| 2669 | =head2 repeat | ||||||||||||||||||||||||||||
| 2670 | |||||||||||||||||||||||||||||
| 2671 | repeat(number $number, string $delimiter) (string) | ||||||||||||||||||||||||||||
| 2672 | |||||||||||||||||||||||||||||
| 2673 | The repeat method repeats the string value N times based on the number provided | ||||||||||||||||||||||||||||
| 2674 | and returns a new concatenated string. Optionally, a delimiter can be provided | ||||||||||||||||||||||||||||
| 2675 | and be place between the occurences. | ||||||||||||||||||||||||||||
| 2676 | |||||||||||||||||||||||||||||
| 2677 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2678 | |||||||||||||||||||||||||||||
| 2679 | =over 4 | ||||||||||||||||||||||||||||
| 2680 | |||||||||||||||||||||||||||||
| 2681 | =item repeat example 1 | ||||||||||||||||||||||||||||
| 2682 | |||||||||||||||||||||||||||||
| 2683 | package main; | ||||||||||||||||||||||||||||
| 2684 | |||||||||||||||||||||||||||||
| 2685 | use Venus::String; | ||||||||||||||||||||||||||||
| 2686 | |||||||||||||||||||||||||||||
| 2687 | my $string = Venus::String->new('999'); | ||||||||||||||||||||||||||||
| 2688 | |||||||||||||||||||||||||||||
| 2689 | my $repeat = $string->repeat(2); | ||||||||||||||||||||||||||||
| 2690 | |||||||||||||||||||||||||||||
| 2691 | # "999999" | ||||||||||||||||||||||||||||
| 2692 | |||||||||||||||||||||||||||||
| 2693 | =back | ||||||||||||||||||||||||||||
| 2694 | |||||||||||||||||||||||||||||
| 2695 | =over 4 | ||||||||||||||||||||||||||||
| 2696 | |||||||||||||||||||||||||||||
| 2697 | =item repeat example 2 | ||||||||||||||||||||||||||||
| 2698 | |||||||||||||||||||||||||||||
| 2699 | package main; | ||||||||||||||||||||||||||||
| 2700 | |||||||||||||||||||||||||||||
| 2701 | use Venus::String; | ||||||||||||||||||||||||||||
| 2702 | |||||||||||||||||||||||||||||
| 2703 | my $string = Venus::String->new('999'); | ||||||||||||||||||||||||||||
| 2704 | |||||||||||||||||||||||||||||
| 2705 | my $repeat = $string->repeat(2, ','); | ||||||||||||||||||||||||||||
| 2706 | |||||||||||||||||||||||||||||
| 2707 | # "999,999" | ||||||||||||||||||||||||||||
| 2708 | |||||||||||||||||||||||||||||
| 2709 | =back | ||||||||||||||||||||||||||||
| 2710 | |||||||||||||||||||||||||||||
| 2711 | =cut | ||||||||||||||||||||||||||||
| 2712 | |||||||||||||||||||||||||||||
| 2713 | =head2 replace | ||||||||||||||||||||||||||||
| 2714 | |||||||||||||||||||||||||||||
| 2715 | replace(regexp $regexp, string $replace, string $flags) (Venus::Replace) | ||||||||||||||||||||||||||||
| 2716 | |||||||||||||||||||||||||||||
| 2717 | The replace method performs a search and replace operation and returns the | ||||||||||||||||||||||||||||
| 2718 | L<Venus::Replace> object. | ||||||||||||||||||||||||||||
| 2719 | |||||||||||||||||||||||||||||
| 2720 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2721 | |||||||||||||||||||||||||||||
| 2722 | =over 4 | ||||||||||||||||||||||||||||
| 2723 | |||||||||||||||||||||||||||||
| 2724 | =item replace example 1 | ||||||||||||||||||||||||||||
| 2725 | |||||||||||||||||||||||||||||
| 2726 | # given: synopsis; | ||||||||||||||||||||||||||||
| 2727 | |||||||||||||||||||||||||||||
| 2728 | my $replace = $string->replace('world', 'universe'); | ||||||||||||||||||||||||||||
| 2729 | |||||||||||||||||||||||||||||
| 2730 | # bless({ | ||||||||||||||||||||||||||||
| 2731 | # ..., | ||||||||||||||||||||||||||||
| 2732 | # "flags" => "", | ||||||||||||||||||||||||||||
| 2733 | # "regexp" => "world", | ||||||||||||||||||||||||||||
| 2734 | # "string" => "hello world", | ||||||||||||||||||||||||||||
| 2735 | # "substr" => "universe", | ||||||||||||||||||||||||||||
| 2736 | # }, "Venus::Replace") | ||||||||||||||||||||||||||||
| 2737 | |||||||||||||||||||||||||||||
| 2738 | =back | ||||||||||||||||||||||||||||
| 2739 | |||||||||||||||||||||||||||||
| 2740 | =cut | ||||||||||||||||||||||||||||
| 2741 | |||||||||||||||||||||||||||||
| 2742 | =head2 reverse | ||||||||||||||||||||||||||||
| 2743 | |||||||||||||||||||||||||||||
| 2744 | reverse() (string) | ||||||||||||||||||||||||||||
| 2745 | |||||||||||||||||||||||||||||
| 2746 | The reverse method returns a string where the characters in the string are in | ||||||||||||||||||||||||||||
| 2747 | the opposite order. | ||||||||||||||||||||||||||||
| 2748 | |||||||||||||||||||||||||||||
| 2749 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2750 | |||||||||||||||||||||||||||||
| 2751 | =over 4 | ||||||||||||||||||||||||||||
| 2752 | |||||||||||||||||||||||||||||
| 2753 | =item reverse example 1 | ||||||||||||||||||||||||||||
| 2754 | |||||||||||||||||||||||||||||
| 2755 | # given: synopsis; | ||||||||||||||||||||||||||||
| 2756 | |||||||||||||||||||||||||||||
| 2757 | my $reverse = $string->reverse; | ||||||||||||||||||||||||||||
| 2758 | |||||||||||||||||||||||||||||
| 2759 | # "dlrow olleh" | ||||||||||||||||||||||||||||
| 2760 | |||||||||||||||||||||||||||||
| 2761 | =back | ||||||||||||||||||||||||||||
| 2762 | |||||||||||||||||||||||||||||
| 2763 | =cut | ||||||||||||||||||||||||||||
| 2764 | |||||||||||||||||||||||||||||
| 2765 | =head2 rindex | ||||||||||||||||||||||||||||
| 2766 | |||||||||||||||||||||||||||||
| 2767 | rindex(string $substr, number $start) (string) | ||||||||||||||||||||||||||||
| 2768 | |||||||||||||||||||||||||||||
| 2769 | The rindex method searches for the argument within the string and returns the | ||||||||||||||||||||||||||||
| 2770 | position of the last occurrence of the argument. | ||||||||||||||||||||||||||||
| 2771 | |||||||||||||||||||||||||||||
| 2772 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2773 | |||||||||||||||||||||||||||||
| 2774 | =over 4 | ||||||||||||||||||||||||||||
| 2775 | |||||||||||||||||||||||||||||
| 2776 | =item rindex example 1 | ||||||||||||||||||||||||||||
| 2777 | |||||||||||||||||||||||||||||
| 2778 | package main; | ||||||||||||||||||||||||||||
| 2779 | |||||||||||||||||||||||||||||
| 2780 | use Venus::String; | ||||||||||||||||||||||||||||
| 2781 | |||||||||||||||||||||||||||||
| 2782 | my $string = Venus::String->new('explain the unexplainable'); | ||||||||||||||||||||||||||||
| 2783 | |||||||||||||||||||||||||||||
| 2784 | my $rindex = $string->rindex('explain'); | ||||||||||||||||||||||||||||
| 2785 | |||||||||||||||||||||||||||||
| 2786 | # 14 | ||||||||||||||||||||||||||||
| 2787 | |||||||||||||||||||||||||||||
| 2788 | =back | ||||||||||||||||||||||||||||
| 2789 | |||||||||||||||||||||||||||||
| 2790 | =over 4 | ||||||||||||||||||||||||||||
| 2791 | |||||||||||||||||||||||||||||
| 2792 | =item rindex example 2 | ||||||||||||||||||||||||||||
| 2793 | |||||||||||||||||||||||||||||
| 2794 | package main; | ||||||||||||||||||||||||||||
| 2795 | |||||||||||||||||||||||||||||
| 2796 | use Venus::String; | ||||||||||||||||||||||||||||
| 2797 | |||||||||||||||||||||||||||||
| 2798 | my $string = Venus::String->new('explain the unexplainable'); | ||||||||||||||||||||||||||||
| 2799 | |||||||||||||||||||||||||||||
| 2800 | my $rindex = $string->rindex('explained'); | ||||||||||||||||||||||||||||
| 2801 | |||||||||||||||||||||||||||||
| 2802 | # -1 | ||||||||||||||||||||||||||||
| 2803 | |||||||||||||||||||||||||||||
| 2804 | =back | ||||||||||||||||||||||||||||
| 2805 | |||||||||||||||||||||||||||||
| 2806 | =over 4 | ||||||||||||||||||||||||||||
| 2807 | |||||||||||||||||||||||||||||
| 2808 | =item rindex example 3 | ||||||||||||||||||||||||||||
| 2809 | |||||||||||||||||||||||||||||
| 2810 | package main; | ||||||||||||||||||||||||||||
| 2811 | |||||||||||||||||||||||||||||
| 2812 | use Venus::String; | ||||||||||||||||||||||||||||
| 2813 | |||||||||||||||||||||||||||||
| 2814 | my $string = Venus::String->new('explain the unexplainable'); | ||||||||||||||||||||||||||||
| 2815 | |||||||||||||||||||||||||||||
| 2816 | my $rindex = $string->rindex('explain', 21); | ||||||||||||||||||||||||||||
| 2817 | |||||||||||||||||||||||||||||
| 2818 | # 14 | ||||||||||||||||||||||||||||
| 2819 | |||||||||||||||||||||||||||||
| 2820 | =back | ||||||||||||||||||||||||||||
| 2821 | |||||||||||||||||||||||||||||
| 2822 | =cut | ||||||||||||||||||||||||||||
| 2823 | |||||||||||||||||||||||||||||
| 2824 | =head2 search | ||||||||||||||||||||||||||||
| 2825 | |||||||||||||||||||||||||||||
| 2826 | search(regexp $regexp) (Venus::Search) | ||||||||||||||||||||||||||||
| 2827 | |||||||||||||||||||||||||||||
| 2828 | The search method performs a search operation and returns the L<Venus::Search> | ||||||||||||||||||||||||||||
| 2829 | object. | ||||||||||||||||||||||||||||
| 2830 | |||||||||||||||||||||||||||||
| 2831 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2832 | |||||||||||||||||||||||||||||
| 2833 | =over 4 | ||||||||||||||||||||||||||||
| 2834 | |||||||||||||||||||||||||||||
| 2835 | =item search example 1 | ||||||||||||||||||||||||||||
| 2836 | |||||||||||||||||||||||||||||
| 2837 | # given: synopsis; | ||||||||||||||||||||||||||||
| 2838 | |||||||||||||||||||||||||||||
| 2839 | my $search = $string->search('world'); | ||||||||||||||||||||||||||||
| 2840 | |||||||||||||||||||||||||||||
| 2841 | # bless({ | ||||||||||||||||||||||||||||
| 2842 | # ..., | ||||||||||||||||||||||||||||
| 2843 | # "flags" => "", | ||||||||||||||||||||||||||||
| 2844 | # "regexp" => "world", | ||||||||||||||||||||||||||||
| 2845 | # "string" => "hello world", | ||||||||||||||||||||||||||||
| 2846 | # }, "Venus::Search") | ||||||||||||||||||||||||||||
| 2847 | |||||||||||||||||||||||||||||
| 2848 | =back | ||||||||||||||||||||||||||||
| 2849 | |||||||||||||||||||||||||||||
| 2850 | =cut | ||||||||||||||||||||||||||||
| 2851 | |||||||||||||||||||||||||||||
| 2852 | =head2 snakecase | ||||||||||||||||||||||||||||
| 2853 | |||||||||||||||||||||||||||||
| 2854 | snakecase() (string) | ||||||||||||||||||||||||||||
| 2855 | |||||||||||||||||||||||||||||
| 2856 | The snakecase method converts the string to snakecase. | ||||||||||||||||||||||||||||
| 2857 | |||||||||||||||||||||||||||||
| 2858 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2859 | |||||||||||||||||||||||||||||
| 2860 | =over 4 | ||||||||||||||||||||||||||||
| 2861 | |||||||||||||||||||||||||||||
| 2862 | =item snakecase example 1 | ||||||||||||||||||||||||||||
| 2863 | |||||||||||||||||||||||||||||
| 2864 | # given: synopsis; | ||||||||||||||||||||||||||||
| 2865 | |||||||||||||||||||||||||||||
| 2866 | my $snakecase = $string->snakecase; | ||||||||||||||||||||||||||||
| 2867 | |||||||||||||||||||||||||||||
| 2868 | # "hello_world" | ||||||||||||||||||||||||||||
| 2869 | |||||||||||||||||||||||||||||
| 2870 | =back | ||||||||||||||||||||||||||||
| 2871 | |||||||||||||||||||||||||||||
| 2872 | =cut | ||||||||||||||||||||||||||||
| 2873 | |||||||||||||||||||||||||||||
| 2874 | =head2 split | ||||||||||||||||||||||||||||
| 2875 | |||||||||||||||||||||||||||||
| 2876 | split(string | regexp $expr, maybe[number] $limit) (arrayref) | ||||||||||||||||||||||||||||
| 2877 | |||||||||||||||||||||||||||||
| 2878 | The split method returns an arrayref by splitting the string on the argument. | ||||||||||||||||||||||||||||
| 2879 | |||||||||||||||||||||||||||||
| 2880 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2881 | |||||||||||||||||||||||||||||
| 2882 | =over 4 | ||||||||||||||||||||||||||||
| 2883 | |||||||||||||||||||||||||||||
| 2884 | =item split example 1 | ||||||||||||||||||||||||||||
| 2885 | |||||||||||||||||||||||||||||
| 2886 | package main; | ||||||||||||||||||||||||||||
| 2887 | |||||||||||||||||||||||||||||
| 2888 | use Venus::String; | ||||||||||||||||||||||||||||
| 2889 | |||||||||||||||||||||||||||||
| 2890 | my $string = Venus::String->new('name, age, dob, email'); | ||||||||||||||||||||||||||||
| 2891 | |||||||||||||||||||||||||||||
| 2892 | my $split = $string->split(', '); | ||||||||||||||||||||||||||||
| 2893 | |||||||||||||||||||||||||||||
| 2894 | # ["name", "age", "dob", "email"] | ||||||||||||||||||||||||||||
| 2895 | |||||||||||||||||||||||||||||
| 2896 | =back | ||||||||||||||||||||||||||||
| 2897 | |||||||||||||||||||||||||||||
| 2898 | =over 4 | ||||||||||||||||||||||||||||
| 2899 | |||||||||||||||||||||||||||||
| 2900 | =item split example 2 | ||||||||||||||||||||||||||||
| 2901 | |||||||||||||||||||||||||||||
| 2902 | package main; | ||||||||||||||||||||||||||||
| 2903 | |||||||||||||||||||||||||||||
| 2904 | use Venus::String; | ||||||||||||||||||||||||||||
| 2905 | |||||||||||||||||||||||||||||
| 2906 | my $string = Venus::String->new('name, age, dob, email'); | ||||||||||||||||||||||||||||
| 2907 | |||||||||||||||||||||||||||||
| 2908 | my $split = $string->split(', ', 2); | ||||||||||||||||||||||||||||
| 2909 | |||||||||||||||||||||||||||||
| 2910 | # ["name", "age, dob, email"] | ||||||||||||||||||||||||||||
| 2911 | |||||||||||||||||||||||||||||
| 2912 | =back | ||||||||||||||||||||||||||||
| 2913 | |||||||||||||||||||||||||||||
| 2914 | =over 4 | ||||||||||||||||||||||||||||
| 2915 | |||||||||||||||||||||||||||||
| 2916 | =item split example 3 | ||||||||||||||||||||||||||||
| 2917 | |||||||||||||||||||||||||||||
| 2918 | package main; | ||||||||||||||||||||||||||||
| 2919 | |||||||||||||||||||||||||||||
| 2920 | use Venus::String; | ||||||||||||||||||||||||||||
| 2921 | |||||||||||||||||||||||||||||
| 2922 | my $string = Venus::String->new('name, age, dob, email'); | ||||||||||||||||||||||||||||
| 2923 | |||||||||||||||||||||||||||||
| 2924 | my $split = $string->split(qr/\,\s*/); | ||||||||||||||||||||||||||||
| 2925 | |||||||||||||||||||||||||||||
| 2926 | # ["name", "age", "dob", "email"] | ||||||||||||||||||||||||||||
| 2927 | |||||||||||||||||||||||||||||
| 2928 | =back | ||||||||||||||||||||||||||||
| 2929 | |||||||||||||||||||||||||||||
| 2930 | =cut | ||||||||||||||||||||||||||||
| 2931 | |||||||||||||||||||||||||||||
| 2932 | =head2 stringified | ||||||||||||||||||||||||||||
| 2933 | |||||||||||||||||||||||||||||
| 2934 | stringified() (string) | ||||||||||||||||||||||||||||
| 2935 | |||||||||||||||||||||||||||||
| 2936 | The stringified method returns the object, stringified (i.e. a dump of the | ||||||||||||||||||||||||||||
| 2937 | object's value). | ||||||||||||||||||||||||||||
| 2938 | |||||||||||||||||||||||||||||
| 2939 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 2940 | |||||||||||||||||||||||||||||
| 2941 | =over 4 | ||||||||||||||||||||||||||||
| 2942 | |||||||||||||||||||||||||||||
| 2943 | =item stringified example 1 | ||||||||||||||||||||||||||||
| 2944 | |||||||||||||||||||||||||||||
| 2945 | # given: synopsis; | ||||||||||||||||||||||||||||
| 2946 | |||||||||||||||||||||||||||||
| 2947 | my $stringified = $string->stringified; | ||||||||||||||||||||||||||||
| 2948 | |||||||||||||||||||||||||||||
| 2949 | # "hello world" | ||||||||||||||||||||||||||||
| 2950 | |||||||||||||||||||||||||||||
| 2951 | =back | ||||||||||||||||||||||||||||
| 2952 | |||||||||||||||||||||||||||||
| 2953 | =over 4 | ||||||||||||||||||||||||||||
| 2954 | |||||||||||||||||||||||||||||
| 2955 | =item stringified example 2 | ||||||||||||||||||||||||||||
| 2956 | |||||||||||||||||||||||||||||
| 2957 | package main; | ||||||||||||||||||||||||||||
| 2958 | |||||||||||||||||||||||||||||
| 2959 | use Venus::String; | ||||||||||||||||||||||||||||
| 2960 | |||||||||||||||||||||||||||||
| 2961 | my $string = Venus::String->new("hello\nworld"); | ||||||||||||||||||||||||||||
| 2962 | |||||||||||||||||||||||||||||
| 2963 | my $stringified = $string->stringified; | ||||||||||||||||||||||||||||
| 2964 | |||||||||||||||||||||||||||||
| 2965 | # "hello\\nworld" | ||||||||||||||||||||||||||||
| 2966 | |||||||||||||||||||||||||||||
| 2967 | =back | ||||||||||||||||||||||||||||
| 2968 | |||||||||||||||||||||||||||||
| 2969 | =cut | ||||||||||||||||||||||||||||
| 2970 | |||||||||||||||||||||||||||||
| 2971 | =head2 strip | ||||||||||||||||||||||||||||
| 2972 | |||||||||||||||||||||||||||||
| 2973 | strip() (string) | ||||||||||||||||||||||||||||
| 2974 | |||||||||||||||||||||||||||||
| 2975 | The strip method returns the string replacing occurences of 2 or more | ||||||||||||||||||||||||||||
| 2976 | whitespaces with a single whitespace. | ||||||||||||||||||||||||||||
| 2977 | |||||||||||||||||||||||||||||
| 2978 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 2979 | |||||||||||||||||||||||||||||
| 2980 | =over 4 | ||||||||||||||||||||||||||||
| 2981 | |||||||||||||||||||||||||||||
| 2982 | =item strip example 1 | ||||||||||||||||||||||||||||
| 2983 | |||||||||||||||||||||||||||||
| 2984 | package main; | ||||||||||||||||||||||||||||
| 2985 | |||||||||||||||||||||||||||||
| 2986 | use Venus::String; | ||||||||||||||||||||||||||||
| 2987 | |||||||||||||||||||||||||||||
| 2988 | my $string = Venus::String->new('one, two, three'); | ||||||||||||||||||||||||||||
| 2989 | |||||||||||||||||||||||||||||
| 2990 | my $strip = $string->strip; | ||||||||||||||||||||||||||||
| 2991 | |||||||||||||||||||||||||||||
| 2992 | # "one, two, three" | ||||||||||||||||||||||||||||
| 2993 | |||||||||||||||||||||||||||||
| 2994 | =back | ||||||||||||||||||||||||||||
| 2995 | |||||||||||||||||||||||||||||
| 2996 | =cut | ||||||||||||||||||||||||||||
| 2997 | |||||||||||||||||||||||||||||
| 2998 | =head2 substr | ||||||||||||||||||||||||||||
| 2999 | |||||||||||||||||||||||||||||
| 3000 | substr(number $offset, number $length, string $replace) (string) | ||||||||||||||||||||||||||||
| 3001 | |||||||||||||||||||||||||||||
| 3002 | The substr method calls the core L</substr> function with the object's string | ||||||||||||||||||||||||||||
| 3003 | value. In list context returns the result and the subject. | ||||||||||||||||||||||||||||
| 3004 | |||||||||||||||||||||||||||||
| 3005 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 3006 | |||||||||||||||||||||||||||||
| 3007 | =over 4 | ||||||||||||||||||||||||||||
| 3008 | |||||||||||||||||||||||||||||
| 3009 | =item substr example 1 | ||||||||||||||||||||||||||||
| 3010 | |||||||||||||||||||||||||||||
| 3011 | package main; | ||||||||||||||||||||||||||||
| 3012 | |||||||||||||||||||||||||||||
| 3013 | use Venus::String; | ||||||||||||||||||||||||||||
| 3014 | |||||||||||||||||||||||||||||
| 3015 | my $string = Venus::String->new('hello world'); | ||||||||||||||||||||||||||||
| 3016 | |||||||||||||||||||||||||||||
| 3017 | my $substr = $string->substr(0, 5); | ||||||||||||||||||||||||||||
| 3018 | |||||||||||||||||||||||||||||
| 3019 | # "hello" | ||||||||||||||||||||||||||||
| 3020 | |||||||||||||||||||||||||||||
| 3021 | =back | ||||||||||||||||||||||||||||
| 3022 | |||||||||||||||||||||||||||||
| 3023 | =over 4 | ||||||||||||||||||||||||||||
| 3024 | |||||||||||||||||||||||||||||
| 3025 | =item substr example 2 | ||||||||||||||||||||||||||||
| 3026 | |||||||||||||||||||||||||||||
| 3027 | package main; | ||||||||||||||||||||||||||||
| 3028 | |||||||||||||||||||||||||||||
| 3029 | use Venus::String; | ||||||||||||||||||||||||||||
| 3030 | |||||||||||||||||||||||||||||
| 3031 | my $string = Venus::String->new('hello world'); | ||||||||||||||||||||||||||||
| 3032 | |||||||||||||||||||||||||||||
| 3033 | my $substr = $string->substr(6, 5); | ||||||||||||||||||||||||||||
| 3034 | |||||||||||||||||||||||||||||
| 3035 | # "world" | ||||||||||||||||||||||||||||
| 3036 | |||||||||||||||||||||||||||||
| 3037 | =back | ||||||||||||||||||||||||||||
| 3038 | |||||||||||||||||||||||||||||
| 3039 | =over 4 | ||||||||||||||||||||||||||||
| 3040 | |||||||||||||||||||||||||||||
| 3041 | =item substr example 3 | ||||||||||||||||||||||||||||
| 3042 | |||||||||||||||||||||||||||||
| 3043 | package main; | ||||||||||||||||||||||||||||
| 3044 | |||||||||||||||||||||||||||||
| 3045 | use Venus::String; | ||||||||||||||||||||||||||||
| 3046 | |||||||||||||||||||||||||||||
| 3047 | my $string = Venus::String->new('hello world'); | ||||||||||||||||||||||||||||
| 3048 | |||||||||||||||||||||||||||||
| 3049 | my $substr = $string->substr(6, 5, 'universe'); | ||||||||||||||||||||||||||||
| 3050 | |||||||||||||||||||||||||||||
| 3051 | # "hello universe" | ||||||||||||||||||||||||||||
| 3052 | |||||||||||||||||||||||||||||
| 3053 | =back | ||||||||||||||||||||||||||||
| 3054 | |||||||||||||||||||||||||||||
| 3055 | =over 4 | ||||||||||||||||||||||||||||
| 3056 | |||||||||||||||||||||||||||||
| 3057 | =item substr example 4 | ||||||||||||||||||||||||||||
| 3058 | |||||||||||||||||||||||||||||
| 3059 | package main; | ||||||||||||||||||||||||||||
| 3060 | |||||||||||||||||||||||||||||
| 3061 | use Venus::String; | ||||||||||||||||||||||||||||
| 3062 | |||||||||||||||||||||||||||||
| 3063 | my $string = Venus::String->new('hello world'); | ||||||||||||||||||||||||||||
| 3064 | |||||||||||||||||||||||||||||
| 3065 | my ($result, $subject) = $string->substr(6, 5, 'universe'); | ||||||||||||||||||||||||||||
| 3066 | |||||||||||||||||||||||||||||
| 3067 | # ("world", "hello universe") | ||||||||||||||||||||||||||||
| 3068 | |||||||||||||||||||||||||||||
| 3069 | =back | ||||||||||||||||||||||||||||
| 3070 | |||||||||||||||||||||||||||||
| 3071 | =cut | ||||||||||||||||||||||||||||
| 3072 | |||||||||||||||||||||||||||||
| 3073 | =head2 template | ||||||||||||||||||||||||||||
| 3074 | |||||||||||||||||||||||||||||
| 3075 | template(string | coderef $code, any @args) (any) | ||||||||||||||||||||||||||||
| 3076 | |||||||||||||||||||||||||||||
| 3077 | The template method uses the underlying string value to build and return a | ||||||||||||||||||||||||||||
| 3078 | L<Venus::Template> object, or dispatches to the coderef or method provided. | ||||||||||||||||||||||||||||
| 3079 | |||||||||||||||||||||||||||||
| 3080 | I<Since C<3.04>> | ||||||||||||||||||||||||||||
| 3081 | |||||||||||||||||||||||||||||
| 3082 | =over 4 | ||||||||||||||||||||||||||||
| 3083 | |||||||||||||||||||||||||||||
| 3084 | =item template example 1 | ||||||||||||||||||||||||||||
| 3085 | |||||||||||||||||||||||||||||
| 3086 | package main; | ||||||||||||||||||||||||||||
| 3087 | |||||||||||||||||||||||||||||
| 3088 | use Venus::String; | ||||||||||||||||||||||||||||
| 3089 | |||||||||||||||||||||||||||||
| 3090 | my $string = Venus::String->new('hello {{name}}'); | ||||||||||||||||||||||||||||
| 3091 | |||||||||||||||||||||||||||||
| 3092 | my $template = $string->template; | ||||||||||||||||||||||||||||
| 3093 | |||||||||||||||||||||||||||||
| 3094 | # bless({...}, "Venus::Template") | ||||||||||||||||||||||||||||
| 3095 | |||||||||||||||||||||||||||||
| 3096 | =back | ||||||||||||||||||||||||||||
| 3097 | |||||||||||||||||||||||||||||
| 3098 | =over 4 | ||||||||||||||||||||||||||||
| 3099 | |||||||||||||||||||||||||||||
| 3100 | =item template example 2 | ||||||||||||||||||||||||||||
| 3101 | |||||||||||||||||||||||||||||
| 3102 | package main; | ||||||||||||||||||||||||||||
| 3103 | |||||||||||||||||||||||||||||
| 3104 | use Venus::String; | ||||||||||||||||||||||||||||
| 3105 | |||||||||||||||||||||||||||||
| 3106 | my $string = Venus::String->new('hello {{name}}'); | ||||||||||||||||||||||||||||
| 3107 | |||||||||||||||||||||||||||||
| 3108 | my $template = $string->template('render', undef, { | ||||||||||||||||||||||||||||
| 3109 | name => 'user', | ||||||||||||||||||||||||||||
| 3110 | }); | ||||||||||||||||||||||||||||
| 3111 | |||||||||||||||||||||||||||||
| 3112 | # "hello user" | ||||||||||||||||||||||||||||
| 3113 | |||||||||||||||||||||||||||||
| 3114 | =back | ||||||||||||||||||||||||||||
| 3115 | |||||||||||||||||||||||||||||
| 3116 | =cut | ||||||||||||||||||||||||||||
| 3117 | |||||||||||||||||||||||||||||
| 3118 | =head2 titlecase | ||||||||||||||||||||||||||||
| 3119 | |||||||||||||||||||||||||||||
| 3120 | titlecase() (string) | ||||||||||||||||||||||||||||
| 3121 | |||||||||||||||||||||||||||||
| 3122 | The titlecase method returns the string capitalizing the first character of | ||||||||||||||||||||||||||||
| 3123 | each word. | ||||||||||||||||||||||||||||
| 3124 | |||||||||||||||||||||||||||||
| 3125 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 3126 | |||||||||||||||||||||||||||||
| 3127 | =over 4 | ||||||||||||||||||||||||||||
| 3128 | |||||||||||||||||||||||||||||
| 3129 | =item titlecase example 1 | ||||||||||||||||||||||||||||
| 3130 | |||||||||||||||||||||||||||||
| 3131 | # given: synopsis; | ||||||||||||||||||||||||||||
| 3132 | |||||||||||||||||||||||||||||
| 3133 | my $titlecase = $string->titlecase; | ||||||||||||||||||||||||||||
| 3134 | |||||||||||||||||||||||||||||
| 3135 | # "Hello World" | ||||||||||||||||||||||||||||
| 3136 | |||||||||||||||||||||||||||||
| 3137 | =back | ||||||||||||||||||||||||||||
| 3138 | |||||||||||||||||||||||||||||
| 3139 | =cut | ||||||||||||||||||||||||||||
| 3140 | |||||||||||||||||||||||||||||
| 3141 | =head2 trim | ||||||||||||||||||||||||||||
| 3142 | |||||||||||||||||||||||||||||
| 3143 | trim() (string) | ||||||||||||||||||||||||||||
| 3144 | |||||||||||||||||||||||||||||
| 3145 | The trim method removes one or more consecutive leading and/or trailing spaces | ||||||||||||||||||||||||||||
| 3146 | from the string. | ||||||||||||||||||||||||||||
| 3147 | |||||||||||||||||||||||||||||
| 3148 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 3149 | |||||||||||||||||||||||||||||
| 3150 | =over 4 | ||||||||||||||||||||||||||||
| 3151 | |||||||||||||||||||||||||||||
| 3152 | =item trim example 1 | ||||||||||||||||||||||||||||
| 3153 | |||||||||||||||||||||||||||||
| 3154 | package main; | ||||||||||||||||||||||||||||
| 3155 | |||||||||||||||||||||||||||||
| 3156 | use Venus::String; | ||||||||||||||||||||||||||||
| 3157 | |||||||||||||||||||||||||||||
| 3158 | my $string = Venus::String->new(' system is ready '); | ||||||||||||||||||||||||||||
| 3159 | |||||||||||||||||||||||||||||
| 3160 | my $trim = $string->trim; | ||||||||||||||||||||||||||||
| 3161 | |||||||||||||||||||||||||||||
| 3162 | # "system is ready" | ||||||||||||||||||||||||||||
| 3163 | |||||||||||||||||||||||||||||
| 3164 | =back | ||||||||||||||||||||||||||||
| 3165 | |||||||||||||||||||||||||||||
| 3166 | =cut | ||||||||||||||||||||||||||||
| 3167 | |||||||||||||||||||||||||||||
| 3168 | =head2 tv | ||||||||||||||||||||||||||||
| 3169 | |||||||||||||||||||||||||||||
| 3170 | tv(any $arg) (boolean) | ||||||||||||||||||||||||||||
| 3171 | |||||||||||||||||||||||||||||
| 3172 | The tv method performs a I<"type-and-value-equal-to"> operation using argument | ||||||||||||||||||||||||||||
| 3173 | provided. | ||||||||||||||||||||||||||||
| 3174 | |||||||||||||||||||||||||||||
| 3175 | I<Since C<0.08>> | ||||||||||||||||||||||||||||
| 3176 | |||||||||||||||||||||||||||||
| 3177 | =over 4 | ||||||||||||||||||||||||||||
| 3178 | |||||||||||||||||||||||||||||
| 3179 | =item tv example 1 | ||||||||||||||||||||||||||||
| 3180 | |||||||||||||||||||||||||||||
| 3181 | package main; | ||||||||||||||||||||||||||||
| 3182 | |||||||||||||||||||||||||||||
| 3183 | use Venus::Array; | ||||||||||||||||||||||||||||
| 3184 | use Venus::String; | ||||||||||||||||||||||||||||
| 3185 | |||||||||||||||||||||||||||||
| 3186 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 3187 | my $rvalue = Venus::Array->new; | ||||||||||||||||||||||||||||
| 3188 | |||||||||||||||||||||||||||||
| 3189 | my $result = $lvalue->tv($rvalue); | ||||||||||||||||||||||||||||
| 3190 | |||||||||||||||||||||||||||||
| 3191 | # 0 | ||||||||||||||||||||||||||||
| 3192 | |||||||||||||||||||||||||||||
| 3193 | =back | ||||||||||||||||||||||||||||
| 3194 | |||||||||||||||||||||||||||||
| 3195 | =over 4 | ||||||||||||||||||||||||||||
| 3196 | |||||||||||||||||||||||||||||
| 3197 | =item tv example 2 | ||||||||||||||||||||||||||||
| 3198 | |||||||||||||||||||||||||||||
| 3199 | package main; | ||||||||||||||||||||||||||||
| 3200 | |||||||||||||||||||||||||||||
| 3201 | use Venus::Code; | ||||||||||||||||||||||||||||
| 3202 | use Venus::String; | ||||||||||||||||||||||||||||
| 3203 | |||||||||||||||||||||||||||||
| 3204 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 3205 | my $rvalue = Venus::Code->new; | ||||||||||||||||||||||||||||
| 3206 | |||||||||||||||||||||||||||||
| 3207 | my $result = $lvalue->tv($rvalue); | ||||||||||||||||||||||||||||
| 3208 | |||||||||||||||||||||||||||||
| 3209 | # 0 | ||||||||||||||||||||||||||||
| 3210 | |||||||||||||||||||||||||||||
| 3211 | =back | ||||||||||||||||||||||||||||
| 3212 | |||||||||||||||||||||||||||||
| 3213 | =over 4 | ||||||||||||||||||||||||||||
| 3214 | |||||||||||||||||||||||||||||
| 3215 | =item tv example 3 | ||||||||||||||||||||||||||||
| 3216 | |||||||||||||||||||||||||||||
| 3217 | package main; | ||||||||||||||||||||||||||||
| 3218 | |||||||||||||||||||||||||||||
| 3219 | use Venus::Float; | ||||||||||||||||||||||||||||
| 3220 | use Venus::String; | ||||||||||||||||||||||||||||
| 3221 | |||||||||||||||||||||||||||||
| 3222 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 3223 | my $rvalue = Venus::Float->new; | ||||||||||||||||||||||||||||
| 3224 | |||||||||||||||||||||||||||||
| 3225 | my $result = $lvalue->tv($rvalue); | ||||||||||||||||||||||||||||
| 3226 | |||||||||||||||||||||||||||||
| 3227 | # 0 | ||||||||||||||||||||||||||||
| 3228 | |||||||||||||||||||||||||||||
| 3229 | =back | ||||||||||||||||||||||||||||
| 3230 | |||||||||||||||||||||||||||||
| 3231 | =over 4 | ||||||||||||||||||||||||||||
| 3232 | |||||||||||||||||||||||||||||
| 3233 | =item tv example 4 | ||||||||||||||||||||||||||||
| 3234 | |||||||||||||||||||||||||||||
| 3235 | package main; | ||||||||||||||||||||||||||||
| 3236 | |||||||||||||||||||||||||||||
| 3237 | use Venus::Hash; | ||||||||||||||||||||||||||||
| 3238 | use Venus::String; | ||||||||||||||||||||||||||||
| 3239 | |||||||||||||||||||||||||||||
| 3240 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 3241 | my $rvalue = Venus::Hash->new; | ||||||||||||||||||||||||||||
| 3242 | |||||||||||||||||||||||||||||
| 3243 | my $result = $lvalue->tv($rvalue); | ||||||||||||||||||||||||||||
| 3244 | |||||||||||||||||||||||||||||
| 3245 | # 0 | ||||||||||||||||||||||||||||
| 3246 | |||||||||||||||||||||||||||||
| 3247 | =back | ||||||||||||||||||||||||||||
| 3248 | |||||||||||||||||||||||||||||
| 3249 | =over 4 | ||||||||||||||||||||||||||||
| 3250 | |||||||||||||||||||||||||||||
| 3251 | =item tv example 5 | ||||||||||||||||||||||||||||
| 3252 | |||||||||||||||||||||||||||||
| 3253 | package main; | ||||||||||||||||||||||||||||
| 3254 | |||||||||||||||||||||||||||||
| 3255 | use Venus::Number; | ||||||||||||||||||||||||||||
| 3256 | use Venus::String; | ||||||||||||||||||||||||||||
| 3257 | |||||||||||||||||||||||||||||
| 3258 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 3259 | my $rvalue = Venus::Number->new; | ||||||||||||||||||||||||||||
| 3260 | |||||||||||||||||||||||||||||
| 3261 | my $result = $lvalue->tv($rvalue); | ||||||||||||||||||||||||||||
| 3262 | |||||||||||||||||||||||||||||
| 3263 | # 0 | ||||||||||||||||||||||||||||
| 3264 | |||||||||||||||||||||||||||||
| 3265 | =back | ||||||||||||||||||||||||||||
| 3266 | |||||||||||||||||||||||||||||
| 3267 | =over 4 | ||||||||||||||||||||||||||||
| 3268 | |||||||||||||||||||||||||||||
| 3269 | =item tv example 6 | ||||||||||||||||||||||||||||
| 3270 | |||||||||||||||||||||||||||||
| 3271 | package main; | ||||||||||||||||||||||||||||
| 3272 | |||||||||||||||||||||||||||||
| 3273 | use Venus::Regexp; | ||||||||||||||||||||||||||||
| 3274 | use Venus::String; | ||||||||||||||||||||||||||||
| 3275 | |||||||||||||||||||||||||||||
| 3276 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 3277 | my $rvalue = Venus::Regexp->new; | ||||||||||||||||||||||||||||
| 3278 | |||||||||||||||||||||||||||||
| 3279 | my $result = $lvalue->tv($rvalue); | ||||||||||||||||||||||||||||
| 3280 | |||||||||||||||||||||||||||||
| 3281 | # 0 | ||||||||||||||||||||||||||||
| 3282 | |||||||||||||||||||||||||||||
| 3283 | =back | ||||||||||||||||||||||||||||
| 3284 | |||||||||||||||||||||||||||||
| 3285 | =over 4 | ||||||||||||||||||||||||||||
| 3286 | |||||||||||||||||||||||||||||
| 3287 | =item tv example 7 | ||||||||||||||||||||||||||||
| 3288 | |||||||||||||||||||||||||||||
| 3289 | package main; | ||||||||||||||||||||||||||||
| 3290 | |||||||||||||||||||||||||||||
| 3291 | use Venus::Scalar; | ||||||||||||||||||||||||||||
| 3292 | use Venus::String; | ||||||||||||||||||||||||||||
| 3293 | |||||||||||||||||||||||||||||
| 3294 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 3295 | my $rvalue = Venus::Scalar->new; | ||||||||||||||||||||||||||||
| 3296 | |||||||||||||||||||||||||||||
| 3297 | my $result = $lvalue->tv($rvalue); | ||||||||||||||||||||||||||||
| 3298 | |||||||||||||||||||||||||||||
| 3299 | # 0 | ||||||||||||||||||||||||||||
| 3300 | |||||||||||||||||||||||||||||
| 3301 | =back | ||||||||||||||||||||||||||||
| 3302 | |||||||||||||||||||||||||||||
| 3303 | =over 4 | ||||||||||||||||||||||||||||
| 3304 | |||||||||||||||||||||||||||||
| 3305 | =item tv example 8 | ||||||||||||||||||||||||||||
| 3306 | |||||||||||||||||||||||||||||
| 3307 | package main; | ||||||||||||||||||||||||||||
| 3308 | |||||||||||||||||||||||||||||
| 3309 | use Venus::String; | ||||||||||||||||||||||||||||
| 3310 | |||||||||||||||||||||||||||||
| 3311 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 3312 | my $rvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 3313 | |||||||||||||||||||||||||||||
| 3314 | my $result = $lvalue->tv($rvalue); | ||||||||||||||||||||||||||||
| 3315 | |||||||||||||||||||||||||||||
| 3316 | # 1 | ||||||||||||||||||||||||||||
| 3317 | |||||||||||||||||||||||||||||
| 3318 | =back | ||||||||||||||||||||||||||||
| 3319 | |||||||||||||||||||||||||||||
| 3320 | =over 4 | ||||||||||||||||||||||||||||
| 3321 | |||||||||||||||||||||||||||||
| 3322 | =item tv example 9 | ||||||||||||||||||||||||||||
| 3323 | |||||||||||||||||||||||||||||
| 3324 | package main; | ||||||||||||||||||||||||||||
| 3325 | |||||||||||||||||||||||||||||
| 3326 | use Venus::String; | ||||||||||||||||||||||||||||
| 3327 | use Venus::Undef; | ||||||||||||||||||||||||||||
| 3328 | |||||||||||||||||||||||||||||
| 3329 | my $lvalue = Venus::String->new; | ||||||||||||||||||||||||||||
| 3330 | my $rvalue = Venus::Undef->new; | ||||||||||||||||||||||||||||
| 3331 | |||||||||||||||||||||||||||||
| 3332 | my $result = $lvalue->tv($rvalue); | ||||||||||||||||||||||||||||
| 3333 | |||||||||||||||||||||||||||||
| 3334 | # 0 | ||||||||||||||||||||||||||||
| 3335 | |||||||||||||||||||||||||||||
| 3336 | =back | ||||||||||||||||||||||||||||
| 3337 | |||||||||||||||||||||||||||||
| 3338 | =cut | ||||||||||||||||||||||||||||
| 3339 | |||||||||||||||||||||||||||||
| 3340 | =head2 uc | ||||||||||||||||||||||||||||
| 3341 | |||||||||||||||||||||||||||||
| 3342 | uc() (string) | ||||||||||||||||||||||||||||
| 3343 | |||||||||||||||||||||||||||||
| 3344 | The uc method returns an uppercased version of the string. | ||||||||||||||||||||||||||||
| 3345 | |||||||||||||||||||||||||||||
| 3346 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 3347 | |||||||||||||||||||||||||||||
| 3348 | =over 4 | ||||||||||||||||||||||||||||
| 3349 | |||||||||||||||||||||||||||||
| 3350 | =item uc example 1 | ||||||||||||||||||||||||||||
| 3351 | |||||||||||||||||||||||||||||
| 3352 | # given: synopsis; | ||||||||||||||||||||||||||||
| 3353 | |||||||||||||||||||||||||||||
| 3354 | my $uc = $string->uc; | ||||||||||||||||||||||||||||
| 3355 | |||||||||||||||||||||||||||||
| 3356 | # "HELLO WORLD" | ||||||||||||||||||||||||||||
| 3357 | |||||||||||||||||||||||||||||
| 3358 | =back | ||||||||||||||||||||||||||||
| 3359 | |||||||||||||||||||||||||||||
| 3360 | =cut | ||||||||||||||||||||||||||||
| 3361 | |||||||||||||||||||||||||||||
| 3362 | =head2 ucfirst | ||||||||||||||||||||||||||||
| 3363 | |||||||||||||||||||||||||||||
| 3364 | ucfirst() (string) | ||||||||||||||||||||||||||||
| 3365 | |||||||||||||||||||||||||||||
| 3366 | The ucfirst method returns a the string with the first character uppercased. | ||||||||||||||||||||||||||||
| 3367 | |||||||||||||||||||||||||||||
| 3368 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 3369 | |||||||||||||||||||||||||||||
| 3370 | =over 4 | ||||||||||||||||||||||||||||
| 3371 | |||||||||||||||||||||||||||||
| 3372 | =item ucfirst example 1 | ||||||||||||||||||||||||||||
| 3373 | |||||||||||||||||||||||||||||
| 3374 | # given: synopsis; | ||||||||||||||||||||||||||||
| 3375 | |||||||||||||||||||||||||||||
| 3376 | my $ucfirst = $string->ucfirst; | ||||||||||||||||||||||||||||
| 3377 | |||||||||||||||||||||||||||||
| 3378 | # "Hello world" | ||||||||||||||||||||||||||||
| 3379 | |||||||||||||||||||||||||||||
| 3380 | =back | ||||||||||||||||||||||||||||
| 3381 | |||||||||||||||||||||||||||||
| 3382 | =cut | ||||||||||||||||||||||||||||
| 3383 | |||||||||||||||||||||||||||||
| 3384 | =head2 uppercase | ||||||||||||||||||||||||||||
| 3385 | |||||||||||||||||||||||||||||
| 3386 | uppercase() (string) | ||||||||||||||||||||||||||||
| 3387 | |||||||||||||||||||||||||||||
| 3388 | The uppercase method is an alias to the uc method. | ||||||||||||||||||||||||||||
| 3389 | |||||||||||||||||||||||||||||
| 3390 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 3391 | |||||||||||||||||||||||||||||
| 3392 | =over 4 | ||||||||||||||||||||||||||||
| 3393 | |||||||||||||||||||||||||||||
| 3394 | =item uppercase example 1 | ||||||||||||||||||||||||||||
| 3395 | |||||||||||||||||||||||||||||
| 3396 | # given: synopsis; | ||||||||||||||||||||||||||||
| 3397 | |||||||||||||||||||||||||||||
| 3398 | my $uppercase = $string->uppercase; | ||||||||||||||||||||||||||||
| 3399 | |||||||||||||||||||||||||||||
| 3400 | # "HELLO WORLD" | ||||||||||||||||||||||||||||
| 3401 | |||||||||||||||||||||||||||||
| 3402 | =back | ||||||||||||||||||||||||||||
| 3403 | |||||||||||||||||||||||||||||
| 3404 | =cut | ||||||||||||||||||||||||||||
| 3405 | |||||||||||||||||||||||||||||
| 3406 | =head2 words | ||||||||||||||||||||||||||||
| 3407 | |||||||||||||||||||||||||||||
| 3408 | words() (within[arrayref, string]) | ||||||||||||||||||||||||||||
| 3409 | |||||||||||||||||||||||||||||
| 3410 | The words method returns an arrayref by splitting on 1 or more consecutive | ||||||||||||||||||||||||||||
| 3411 | spaces. | ||||||||||||||||||||||||||||
| 3412 | |||||||||||||||||||||||||||||
| 3413 | I<Since C<0.01>> | ||||||||||||||||||||||||||||
| 3414 | |||||||||||||||||||||||||||||
| 3415 | =over 4 | ||||||||||||||||||||||||||||
| 3416 | |||||||||||||||||||||||||||||
| 3417 | =item words example 1 | ||||||||||||||||||||||||||||
| 3418 | |||||||||||||||||||||||||||||
| 3419 | package main; | ||||||||||||||||||||||||||||
| 3420 | |||||||||||||||||||||||||||||
| 3421 | use Venus::String; | ||||||||||||||||||||||||||||
| 3422 | |||||||||||||||||||||||||||||
| 3423 | my $string = Venus::String->new( | ||||||||||||||||||||||||||||
| 3424 | 'is this a bug we\'re experiencing' | ||||||||||||||||||||||||||||
| 3425 | ); | ||||||||||||||||||||||||||||
| 3426 | |||||||||||||||||||||||||||||
| 3427 | my $words = $string->words; | ||||||||||||||||||||||||||||
| 3428 | |||||||||||||||||||||||||||||
| 3429 | # ["is", "this", "a", "bug", "we're", "experiencing"] | ||||||||||||||||||||||||||||
| 3430 | |||||||||||||||||||||||||||||
| 3431 | =back | ||||||||||||||||||||||||||||
| 3432 | |||||||||||||||||||||||||||||
| 3433 | =cut | ||||||||||||||||||||||||||||
| 3434 | |||||||||||||||||||||||||||||
| 3435 | =head1 OPERATORS | ||||||||||||||||||||||||||||
| 3436 | |||||||||||||||||||||||||||||
| 3437 | This package overloads the following operators: | ||||||||||||||||||||||||||||
| 3438 | |||||||||||||||||||||||||||||
| 3439 | =cut | ||||||||||||||||||||||||||||
| 3440 | |||||||||||||||||||||||||||||
| 3441 | =over 4 | ||||||||||||||||||||||||||||
| 3442 | |||||||||||||||||||||||||||||
| 3443 | =item operation: C<("")> | ||||||||||||||||||||||||||||
| 3444 | |||||||||||||||||||||||||||||
| 3445 | This package overloads the C<""> operator. | ||||||||||||||||||||||||||||
| 3446 | |||||||||||||||||||||||||||||
| 3447 | B<example 1> | ||||||||||||||||||||||||||||
| 3448 | |||||||||||||||||||||||||||||
| 3449 | # given: synopsis; | ||||||||||||||||||||||||||||
| 3450 | |||||||||||||||||||||||||||||
| 3451 | my $result = "$string"; | ||||||||||||||||||||||||||||
| 3452 | |||||||||||||||||||||||||||||
| 3453 | # "hello world" | ||||||||||||||||||||||||||||
| 3454 | |||||||||||||||||||||||||||||
| 3455 | B<example 2> | ||||||||||||||||||||||||||||
| 3456 | |||||||||||||||||||||||||||||
| 3457 | # given: synopsis; | ||||||||||||||||||||||||||||
| 3458 | |||||||||||||||||||||||||||||
| 3459 | my $result = "$string, $string"; | ||||||||||||||||||||||||||||
| 3460 | |||||||||||||||||||||||||||||
| 3461 | # "hello world, hello world" | ||||||||||||||||||||||||||||
| 3462 | |||||||||||||||||||||||||||||
| 3463 | =back | ||||||||||||||||||||||||||||
| 3464 | |||||||||||||||||||||||||||||
| 3465 | =over 4 | ||||||||||||||||||||||||||||
| 3466 | |||||||||||||||||||||||||||||
| 3467 | =item operation: C<(eq)> | ||||||||||||||||||||||||||||
| 3468 | |||||||||||||||||||||||||||||
| 3469 | This package overloads the C<eq> operator. | ||||||||||||||||||||||||||||
| 3470 | |||||||||||||||||||||||||||||
| 3471 | B<example 1> | ||||||||||||||||||||||||||||
| 3472 | |||||||||||||||||||||||||||||
| 3473 | # given: synopsis; | ||||||||||||||||||||||||||||
| 3474 | |||||||||||||||||||||||||||||
| 3475 | my $result = $string eq 'hello world'; | ||||||||||||||||||||||||||||
| 3476 | |||||||||||||||||||||||||||||
| 3477 | # 1 | ||||||||||||||||||||||||||||
| 3478 | |||||||||||||||||||||||||||||
| 3479 | B<example 2> | ||||||||||||||||||||||||||||
| 3480 | |||||||||||||||||||||||||||||
| 3481 | package main; | ||||||||||||||||||||||||||||
| 3482 | |||||||||||||||||||||||||||||
| 3483 | use Venus::String; | ||||||||||||||||||||||||||||
| 3484 | |||||||||||||||||||||||||||||
| 3485 | my $string1 = Venus::String->new('hello world'); | ||||||||||||||||||||||||||||
| 3486 | my $string2 = Venus::String->new('hello world'); | ||||||||||||||||||||||||||||
| 3487 | |||||||||||||||||||||||||||||
| 3488 | my $result = $string1 eq $string2; | ||||||||||||||||||||||||||||
| 3489 | |||||||||||||||||||||||||||||
| 3490 | # 1 | ||||||||||||||||||||||||||||
| 3491 | |||||||||||||||||||||||||||||
| 3492 | =back | ||||||||||||||||||||||||||||
| 3493 | |||||||||||||||||||||||||||||
| 3494 | =over 4 | ||||||||||||||||||||||||||||
| 3495 | |||||||||||||||||||||||||||||
| 3496 | =item operation: C<(ne)> | ||||||||||||||||||||||||||||
| 3497 | |||||||||||||||||||||||||||||
| 3498 | This package overloads the C<ne> operator. | ||||||||||||||||||||||||||||
| 3499 | |||||||||||||||||||||||||||||
| 3500 | B<example 1> | ||||||||||||||||||||||||||||
| 3501 | |||||||||||||||||||||||||||||
| 3502 | # given: synopsis; | ||||||||||||||||||||||||||||
| 3503 | |||||||||||||||||||||||||||||
| 3504 | my $result = $string ne 'Hello world'; | ||||||||||||||||||||||||||||
| 3505 | |||||||||||||||||||||||||||||
| 3506 | # 1 | ||||||||||||||||||||||||||||
| 3507 | |||||||||||||||||||||||||||||
| 3508 | B<example 2> | ||||||||||||||||||||||||||||
| 3509 | |||||||||||||||||||||||||||||
| 3510 | package main; | ||||||||||||||||||||||||||||
| 3511 | |||||||||||||||||||||||||||||
| 3512 | use Venus::String; | ||||||||||||||||||||||||||||
| 3513 | |||||||||||||||||||||||||||||
| 3514 | my $string1 = Venus::String->new('hello world'); | ||||||||||||||||||||||||||||
| 3515 | my $string2 = Venus::String->new('Hello world'); | ||||||||||||||||||||||||||||
| 3516 | |||||||||||||||||||||||||||||
| 3517 | my $result = $string1 ne $string2; | ||||||||||||||||||||||||||||
| 3518 | |||||||||||||||||||||||||||||
| 3519 | # 1 | ||||||||||||||||||||||||||||
| 3520 | |||||||||||||||||||||||||||||
| 3521 | =back | ||||||||||||||||||||||||||||
| 3522 | |||||||||||||||||||||||||||||
| 3523 | =over 4 | ||||||||||||||||||||||||||||
| 3524 | |||||||||||||||||||||||||||||
| 3525 | =item operation: C<(qr)> | ||||||||||||||||||||||||||||
| 3526 | |||||||||||||||||||||||||||||
| 3527 | This package overloads the C<qr> operator. | ||||||||||||||||||||||||||||
| 3528 | |||||||||||||||||||||||||||||
| 3529 | B<example 1> | ||||||||||||||||||||||||||||
| 3530 | |||||||||||||||||||||||||||||
| 3531 | # given: synopsis; | ||||||||||||||||||||||||||||
| 3532 | |||||||||||||||||||||||||||||
| 3533 | my $test = 'hello world' =~ qr/$string/; | ||||||||||||||||||||||||||||
| 3534 | |||||||||||||||||||||||||||||
| 3535 | # 1 | ||||||||||||||||||||||||||||
| 3536 | |||||||||||||||||||||||||||||
| 3537 | =back | ||||||||||||||||||||||||||||
| 3538 | |||||||||||||||||||||||||||||
| 3539 | =head1 AUTHORS | ||||||||||||||||||||||||||||
| 3540 | |||||||||||||||||||||||||||||
| 3541 | Awncorp, C<awncorp@cpan.org> | ||||||||||||||||||||||||||||
| 3542 | |||||||||||||||||||||||||||||
| 3543 | =cut | ||||||||||||||||||||||||||||
| 3544 | |||||||||||||||||||||||||||||
| 3545 | =head1 LICENSE | ||||||||||||||||||||||||||||
| 3546 | |||||||||||||||||||||||||||||
| 3547 | Copyright (C) 2000, Awncorp, C<awncorp@cpan.org>. | ||||||||||||||||||||||||||||
| 3548 | |||||||||||||||||||||||||||||
| 3549 | This program is free software, you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 3550 | the terms of the Apache license version 2.0. | ||||||||||||||||||||||||||||
| 3551 | |||||||||||||||||||||||||||||
| 3552 | =cut | ||||||||||||||||||||||||||||