String::FormatX - Perl extension for formatting strings and numbers
Formats a string based on pre-defined String::FormatX templates or user-supplied template patterns.
You will need all of the modules below to be installed for the String::FormatX library to work.
# As a function library... use String::FormatX qw(FormatX); my $FormattedSSN = FormatX('123456789','999-99-9999'); print $FormattedSSN; # prints 123-45-6789 my $GreenMoney = FormatX('123456789','~PRICE'); print $GreenMoney; # prints $ 1,234,567.89 # As an object... use String::FormatX; my $StrObj = new String::FormatX; my $FormattedSSN = $StrObj->FormatX('123456789','999-99-9999'); print $FormattedSSN; # prints 123-45-6789
Lance P. Cleveland Charleston Software Associates (www.CharlestonSW.com) (c) 2005-2006 - Charleston Software Associates, Inc.
Create a new String::FormatX object. Properties ERRMSG - contains last error message generated during String::FormatX processing
Create a new FormatX object.
Return a string formatted as instructed. Parameters STR => Input string to be formatted FORMAT => Format template
FORMAT can be set to a predefined string as in FORMAT=>'~PRICE' or to a user-defined output string as in FORMAT=>'999-99-9999'. Predefined Strings ~PRICE - return a price starting with "$ ", comma separated, and 2 decimal precision User Defined Strings 9 - only a numeric allowed in this position X - alphanumeric and '_' allowed in this position All other characters are taken as literal replacements within the text. Processing When a '9' or 'X' appears in the format string the input string is processed scanning for the next numeric or alphanumeric throwing away all interim characters during the search. In other words, if we are looking for digit format such as '999.99' and we get 'blah12blah345' you end up with '123.45' because we threw away the blah blah.
2 POD Errors
The following errors were encountered while parsing the POD:
=over without closing =back
=back doesn't take any parameters, but you said =back Returns STR formatted according to FORMAT setting
To install String::FormatX, copy and paste the appropriate command in to your terminal.
cpanm
cpanm String::FormatX
CPAN shell
perl -MCPAN -e shell install String::FormatX
For more information on module installation, please visit the detailed CPAN module installation guide.