YVDHOVE::String - This Perl module provides "String" functions for the YVDHOVE framework


YVDHOVE-String documentation Contained in the YVDHOVE-String distribution.

Index


Code Index:

NAME

Top

YVDHOVE::String - This Perl module provides "String" functions for the YVDHOVE framework

SYNOPSIS

Top

  use YVDHOVE::String qw(:all);

  my $string = "  \t  Hello world!   ";

  print trim($string) ."\n";
  print ltrim($string)."\n";
  print rtrim($string)."\n";

DESCRIPTION

Top

This Perl module provides "String" functions for the YVDHOVE framework

EXPORT

Top

None by default.

METHODS

Top

trim(STRING);

trim function to remove whitespace from the start and end of the string

ltrim(STRING);

trim function to remove leading whitespace

rtrim(STRING);

trim function to remove trailing whitespace

SEE ALSO

Top

See http://search.cpan.org/search?query=YVDHOVE&mode=all

AUTHORS

Top

Yves Van den Hove, <yvdhove@users.sourceforge.net>

BUGS

Top

See http://rt.cpan.org to report and view bugs.

COPYRIGHT AND LICENSE

Top


YVDHOVE-String documentation Contained in the YVDHOVE-String distribution.

package YVDHOVE::String;

use 5.008007;
use strict;
use warnings;

require Exporter;

# ---------------------------------------------------------------------------------

our @ISA = qw(Exporter);

our %EXPORT_TAGS = ( 'all' => [ qw( trim 
									ltrim
									rtrim) ] );
our @EXPORT_OK   = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT      = qw();

our $VERSION     = '1.05';

# ---------------------------------------------------------------------------------

# Trim function removes leading and trailing whitespaces
sub trim($) {
	my $string = shift;
	$string =~ s/^\s+//;
	$string =~ s/\s+$//;
	return $string;
}

# Left trim function to remove leading whitespaces
sub ltrim($) {
	my $string = shift;
	$string =~ s/^\s+//;
	return $string;
}

# Right trim function to remove trailing whitespaces
sub rtrim($) {
	my $string = shift;
	$string =~ s/\s+$//;
	return $string;
}

# ---------------------------------------------------------------------------------

1;

# ---------------------------------------------------------------------------------
__END__