NAME

Maplat::Helpers::Padding - string padding/trimming helpers

SYNOPSIS

use Maplat::Helpers::Padding qw(doFPad doSpacePad trim);

# front pad string with zeroes
my $padded = doFPad("100", 10);

# pad string with spaces
my $padded = doSpacePad("Hello World", 20);

# trim start and end whitespace
my $trimmed = trim(" Hello, world!     ");

DESCRIPTION

This module provides a few string padding and trimming helpers, used throughout the MAPLAT framework.

doFPad

Takes two arguments, $text and $length and returns the padded string.

$text is the string to be padded to the desired $length with zeroes in front.

my $padded = doFPad("100", 5); # returns "00100"

doSpacePad

Takes two arguments, $text and $length and returns the padded string.

$text is the string to be padded to the desired $length with spaces at the end.

my $padded = doSpacePad("100", 5); # returns "100  "

trim

Takes one argument, the string to be trimmed. Returns the string with whitespace remoned from start and end of that string.

my $trimmed = trim("  test  "); # returns "test"

AUTHOR

Rene Schickbauer, <rene.schickbauer@magnapowertrain.com>

COPYRIGHT AND LICENSE

Copyright (C) 2009 by Rene Schickbauer

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.