Maplat::Helpers::Strings - special string handling functions
use Maplat::Helpers::Strings qw(tabsToTable normalizeString); my $tableline = tabsToTable($text, @lengths); my $newstring = normalizeString($text);
This module is home to some specialized functions for modifying strings. Most people wont need this but i find them rather helpfull in some cases.
This function turns a tab delimated text string into a space-padded line suitable for printing ascii-art tables.
Takes two arguments, a $textstring with multiple fields delimated by tabs, and an array with field lengths. The second argument is an array of desired field lengths.
Example:
my @length = (5, 8, 7); my @spies = ("007\tBond\tJames", "008\tDoe\tJohn"); ... foreach my $spy (@spies) { print tabsToTable($spy); }
Prints out:
007 Bond James 008 Doe John
Removed unneeded whitespaces as well as all other non-word characters from a string.
Takes one argument, a text string and returns a "normalized" version of this string.
Rene Schickbauer, <rene.schickbauer@gmail.com>
Copyright (C) 2008-2011 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.
To install Maplat, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Maplat
CPAN shell
perl -MCPAN -e shell install Maplat
For more information on module installation, please visit the detailed CPAN module installation guide.