| 1 | 53 | ▶ | use strict; use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | package Lingy::String; | ||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | 53 | ▶ | use Lingy::Common; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 53 | ▶ | use base 'Lingy::ScalarClass'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 53 | ▶ | use overload cmp => \&comp_pair; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | sub append { | ||||||||||||||||||||||||||
|
Subroutine
append: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 10 | 1 | my ($self, $str) = @_; | |||||||||||||||||||||||||||
| 11 | 1 | STRING->new("$self$str"); | |||||||||||||||||||||||||||
| 12 | } | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 3 | ▶ | sub endsWith { | ||||||||||||||||||||||||||
|
Subroutine
endsWith: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 15 | 3 | my ($str, $substr) = map "$_", @_; | |||||||||||||||||||||||||||
| 16 | 3 | my ($l1, $l2) = map length("$_"), @_; | |||||||||||||||||||||||||||
| 17 | 3 | ▶ | BOOLEAN->new( | ||||||||||||||||||||||||||
|
Condition66%2/3
$l1 >= $l2 && substr($str, $l1 - $l2) eq $substr
MC/DC50%1/2
$l1 >= $l2 && substr($str, $l1 - $l2) eq $substr
$l1 >= $l2
substr($str, $l1 - $l2) eq $substr
Truth table66%2/3
A && B
A= $l1 >= $l2B= substr($str, $l1 - $l2) eq $substr
| |||||||||||||||||||||||||||||
| 18 | $l1 >= $l2 and | ||||||||||||||||||||||||||||
| 19 | substr($str, $l1 - $l2) eq $substr | ||||||||||||||||||||||||||||
| 20 | ); | ||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 4 | ▶ | sub replaceAll { | ||||||||||||||||||||||||||
|
Subroutine
replaceAll: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 24 | 4 | my ($str, $pat, $rep) = @_; | |||||||||||||||||||||||||||
| 25 | 4 | $str =~ s/\Q$pat\E/$rep/g; | |||||||||||||||||||||||||||
| 26 | 4 | STRING->new($str); | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 0 | ▶ | sub substring { | ||||||||||||||||||||||||||
|
Subroutine
substring: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 30 | 0 | my ($string, $offset1, $offset2) = @_; | |||||||||||||||||||||||||||
| 31 | 0 | my $length = length $string; | |||||||||||||||||||||||||||
| 32 | 0 | ▶ | $offset2 //= NUMBER->new($length); | ||||||||||||||||||||||||||
|
Condition0%0/3
$offset2 //= "Lingy::Number"->new($length)
MC/DC0%0/2
$offset2 //= "Lingy::Number"->new($length)
$offset2
"Lingy::Number"->new($length)
Truth table0%0/3
A //= B
A= $offset2B= "Lingy::Number"->new($length)
| |||||||||||||||||||||||||||||
| 33 | 0 | ▶ | err "Begin index out of range '%d' for string length '%d'", | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$offset1 < 0 or $offset1 > $length
MC/DC0%0/2
$offset1 < 0 or $offset1 > $length
$offset1 < 0
$offset1 > $length
Truth table0%0/3
A or B
A= $offset1 < 0B= $offset1 > $length
| |||||||||||||||||||||||||||||
| 34 | $offset1, $length | ||||||||||||||||||||||||||||
| 35 | if $offset1 < 0 or $offset1 > $length; | ||||||||||||||||||||||||||||
| 36 | 0 | ▶ | err "End index out of range '%d' for string length '%d'", | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$offset2 < $offset1 or $offset2 > $length
MC/DC0%0/2
$offset2 < $offset1 or $offset2 > $length
$offset2 < $offset1
$offset2 > $length
Truth table0%0/3
A or B
A= $offset2 < $offset1B= $offset2 > $length
| |||||||||||||||||||||||||||||
| 37 | $offset2, $length | ||||||||||||||||||||||||||||
| 38 | if $offset2 < $offset1 or $offset2 > $length; | ||||||||||||||||||||||||||||
| 39 | 0 | STRING->new(substr("$string", $offset1, $offset2 - $offset1)) | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 0 | ▶ | sub toLowerCase { | ||||||||||||||||||||||||||
|
Subroutine
toLowerCase: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 43 | 0 | STRING->new(lc $_[0]); | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 4 | ▶ | sub toString { | ||||||||||||||||||||||||||
|
Subroutine
toString: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 47 | 4 | $_[0]; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 7 | ▶ | sub toUpperCase { | ||||||||||||||||||||||||||
|
Subroutine
toUpperCase: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 51 | 7 | STRING->new(uc $_[0]); | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 5 | ▶ | sub _to_seq { | ||||||||||||||||||||||||||
|
Subroutine
_to_seq: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 55 | 5 | my ($str) = @_; | |||||||||||||||||||||||||||
| 56 | 5 | ▶ | return nil unless length $str; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 57 | 3 | list([ | |||||||||||||||||||||||||||
| 58 | map CHARACTER->read("\\$_"), split //, $$str | ||||||||||||||||||||||||||||
| 59 | ]); | ||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 53 | 1; | |||||||||||||||||||||||||||