--- nfo/perl/libs/Data/Mungle/Transform/String.pm 2003/01/19 03:27:36 1.1 +++ nfo/perl/libs/Data/Mungle/Transform/String.pm 2003/02/21 08:37:25 1.4 @@ -1,11 +1,19 @@ -## --------------------------------------------------------------------------- -## $Id: String.pm,v 1.1 2003/01/19 03:27:36 joko Exp $ -## --------------------------------------------------------------------------- +## ------------------------------------------------------------------------- +## $Id: String.pm,v 1.4 2003/02/21 08:37:25 joko Exp $ +## ------------------------------------------------------------------------- ## $Log: String.pm,v $ +## Revision 1.4 2003/02/21 08:37:25 joko +## minor fix +## +## Revision 1.3 2003/02/20 21:23:34 joko +## using 'trim_space' from Pitonyak::StringUtil as a replacement for our 'trim' +## +## Revision 1.2 2003/01/31 01:22:19 root +## + sub getLastPart +## ## Revision 1.1 2003/01/19 03:27:36 joko ## + initial check-in -## -## --------------------------------------------------------------------------- +## ------------------------------------------------------------------------- package Data::Transform::String; @@ -16,9 +24,12 @@ require Exporter; our @ISA = qw( Exporter ); our @EXPORT_OK = qw( - stripHtml stripSpaces stripNewLines toReal trim + stripHtml stripNewLines toReal getLastPart trim ); + +use Pitonyak::StringUtil qw( trim_space ); + sub stripHtml { my $html = shift; my $result = ''; @@ -36,18 +47,8 @@ return $result; } -sub stripSpaces { - my $text = shift; - #print "text: $text", "\n"; - #print "ord: ", ord(substr($text, 0, 1)), "\n"; - $text =~ s/^\s*//g; - $text =~ s/\s*$//g; - return $text; -} - sub trim { - my $string = shift; - return stripSpaces($string); + trim_space(@_); } sub stripNewLines { @@ -66,4 +67,12 @@ return $real; } +sub getLastPart { + my $which = shift; + my $seperator = shift; + $seperator ||= '\/'; + $which =~ m/^.*$seperator(.+?)$/; + return $1; +} + 1;