NAME

Pitonyak::StringUtil - File and directory scanning based on regular expressions.


SYNOPSIS

use Pitonyak::StringUtil


DESCRIPTION

array_width

array_width([arg1], [arg2], ... [argn])

Find the maximum width of a list of elements. Each element should either be a scalar or a reference to an array.

center_fmt

center_fmt($width_to_use, @strings_to_format)

Center the strings in the specified width. the strings are left and right padded to use the entire width. The strings are truncated to fit into the space.

compact_space

compact_space(@list_of_strings)

Removes the spaces from the strings.

Each string is potentially modified. Leading and trailing white space is removed. Runs of white space is turned to one space. This modifies the calling parameters.

hash_key_width

hash_key_width($hash_reference)

Determine the maximum width of the keys in this hash

hash_val_width

hash_val_width($hash_reference)

Determine the maximum width of the values in this hash

left_fmt

left_fmt($width_to_use, @strings_to_format)

Each string has enough spaces appended end so that the total length is $width_to_use. The strings are not truncated to fit into the space.

num_int_digits

num_int_digits($number)

This returns the length of a number

num_with_leading_zeros

num_with_leading_zeros(($width_to_use, @numbers_to_format)

Returns N-digit strings representing the number with leading zeros.

Modulo is used to chop the number.

If numDigits < 0, then leading negative signs are included.

trans_blank

trans_blank($value, [$default])

Returns $value if it is defined with length greater than zero and $default if it is not.

If $default is not included, then an empty string is used for $default.

trim_fmt

trim_fmt($width_to_use, @strings_to_format)

Trim all strings so that their length is not greater than $width_to_use.

trim_space

trim_space(@strings_to_format)

Remove leading and trailing white space. The parameters are modified.

right_fmt

right_fmt($width_to_use, @strings_to_format)

Each string has enough spaces prepended end so that the total length is $width_to_use. The strings are not truncated to fit into the space.

smart_printer

smart_printer($left, $left_grow, $separator, @Things_to_print)

Attempts to print almost any object in a pretty fashion. The $left parameter determines what is printed before each thing printed. The $left_grow parameter determines the new $left if smart_printer() is recursively called. the $separator is printed between each item.

A Scalar is printed.

A Hash is printed as { key => value key => value }

An Array is printed as ( value value )

Keys and values can also be references.

smart_printer_default

smart_printer_default(Things to print)

Each parameter is printed using smart_printer() using default parameters. the items are printed with no initial left indent, recursive indents using two extra spaces, and a new line for the item separator.


COPYRIGHT

Copyright 1998-2002, Andrew Pitonyak (perlboy@pitonyak.org)

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


Modification History

March 13, 1998

Version 1.00 First release

September 10, 2002

Version 1.01 Changed internal documentation to POD