| 1 | package YVDHOVE::String; | ||
| 2 | |||
| 3 | 1 | ▶ | use 5.008007; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 1 | require Exporter; | |
| 8 | |||
| 9 | # --------------------------------------------------------------------------------- | ||
| 10 | |||
| 11 | 1 | our @ISA = qw(Exporter); | |
| 12 | |||
| 13 | 1 | our %EXPORT_TAGS = ( 'all' => [ qw( trim | |
| 14 | ltrim | ||
| 15 | rtrim) ] ); | ||
| 16 | 1 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
| 17 | 1 | our @EXPORT = qw(); | |
| 18 | |||
| 19 | 1 | our $VERSION = '1.05'; | |
| 20 | |||
| 21 | # --------------------------------------------------------------------------------- | ||
| 22 | |||
| 23 | # Trim function removes leading and trailing whitespaces | ||
| 24 | 1 | ▶ | sub trim($) { |
|
Subroutine
trim: called CC=1 SCAR=0.0
Pod
documented
| |||
| 25 | 1 | my $string = shift; | |
| 26 | 1 | $string =~ s/^\s+//; | |
| 27 | 1 | $string =~ s/\s+$//; | |
| 28 | 1 | return $string; | |
| 29 | } | ||
| 30 | |||
| 31 | # Left trim function to remove leading whitespaces | ||
| 32 | 1 | ▶ | sub ltrim($) { |
|
Subroutine
ltrim: called CC=1 SCAR=0.0
Pod
documented
| |||
| 33 | 1 | my $string = shift; | |
| 34 | 1 | $string =~ s/^\s+//; | |
| 35 | 1 | return $string; | |
| 36 | } | ||
| 37 | |||
| 38 | # Right trim function to remove trailing whitespaces | ||
| 39 | 1 | ▶ | sub rtrim($) { |
|
Subroutine
rtrim: called CC=1 SCAR=0.0
Pod
documented
| |||
| 40 | 1 | my $string = shift; | |
| 41 | 1 | $string =~ s/\s+$//; | |
| 42 | 1 | return $string; | |
| 43 | } | ||
| 44 | |||
| 45 | # --------------------------------------------------------------------------------- | ||
| 46 | |||
| 47 | 1 | 1; | |
| 48 | |||
| 49 | # --------------------------------------------------------------------------------- | ||
| 50 | __END__ | ||