| 1 | #!/usr/bin/perl -w | ||||||||||
| 2 | |||||||||||
| 3 | package Ftree::StringUtils; | ||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use Params::Validate qw(:all); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use version; our $VERSION = qv('2.3.41'); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | # Perl trim function to remove whitespace from the start and end of the string | ||||||||||
| 10 | sub trim | ||||||||||
| 11 | 13 | ▶ | { | ||||||||
|
Subroutine
trim: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||
| 12 | 13 | my ($string) = validate_pos(@_, {type => SCALAR|UNDEF}); | |||||||||
| 13 | 13 | ▶ | return rtrim(ltrim($string)) if (defined $string); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | } | ||||||||||
| 15 | # Left trim function to remove leading whitespace | ||||||||||
| 16 | sub ltrim | ||||||||||
| 17 | 13 | ▶ | { | ||||||||
|
Subroutine
ltrim: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 18 | 13 | my ($string) = validate_pos(@_, {type => SCALAR|UNDEF}); | |||||||||
| 19 | 13 | $string =~ s/^\s+//; | |||||||||
| 20 | 13 | return $string; | |||||||||
| 21 | } | ||||||||||
| 22 | # Right trim function to remove trailing whitespace | ||||||||||
| 23 | sub rtrim | ||||||||||
| 24 | 13 | ▶ | { | ||||||||
|
Subroutine
rtrim: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 25 | 13 | my ($string) = validate_pos(@_, {type => SCALAR|UNDEF});; | |||||||||
| 26 | 13 | $string =~ s/\s+$//; | |||||||||
| 27 | 13 | return $string; | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 2 | 1; | |||||||||