MDK::Common::String

Section: User Contributed Perl Documentation (3)
Updated: 2014-01-24
Page Index
 

NAME

MDK::Common::String - formatting functions  

SYNOPSIS

    use MDK::Common::String qw(:all);

 

EXPORTS

bestMatchSentence(STRING, LIST)
finds in the list the best corresponding string
formatList(INT, LIST)
if the list size is bigger than INT, replace the remaining elements with ``...''.

formatList(3, qw(a b c d e)) # => ``a, b, c, ...''

formatError(STRING)
the string is something like ``error at foo.pl line 2'' that you get when catching an exception. formatError will remove the ``at ...'' so that you can nicely display the returned string to the user
formatTimeRaw(TIME)
the TIME is an epoch as returned by "time", the formatted time looks like ``23:59:00''
formatLines(STRING)
remove ``\n''s when the next line doesn't start with a space. Otherwise keep ``\n''s to keep the indentation.
formatAlaTeX(STRING)
handle carriage return just like LaTeX: merge lines that are not separated by an empty line
begins_with(STRING, STRING)
return true if first argument begins with the second argument. Use this instead of regexps if you don't want regexps.

begins_with(``hello world'', ``hello'') # => 1

warp_text(STRING, INT)
return a list of lines which do not exceed INT characters (or a string in scalar context)
warp_text(STRING)
warp_text at a default width (80)
 

SEE ALSO

MDK::Common


 

Index

NAME
SYNOPSIS
EXPORTS
SEE ALSO
LinuxReviews : manual page archive : man3pm