/[cvs]/nfo/perl/libs/Data/Mungle/Transform/String.pm
ViewVC logotype

Diff of /nfo/perl/libs/Data/Mungle/Transform/String.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by joko, Sun Jan 19 03:27:36 2003 UTC revision 1.4 by joko, Fri Feb 21 08:37:25 2003 UTC
# Line 1  Line 1 
1  ## ---------------------------------------------------------------------------  ## -------------------------------------------------------------------------
2  ##  $Id$  ##  $Id$
3  ## ---------------------------------------------------------------------------  ## -------------------------------------------------------------------------
4  ##  $Log$  ##  $Log$
5    ##  Revision 1.4  2003/02/21 08:37:25  joko
6    ##  minor fix
7    ##
8    ##  Revision 1.3  2003/02/20 21:23:34  joko
9    ##  using 'trim_space' from Pitonyak::StringUtil as a replacement for our 'trim'
10    ##
11    ##  Revision 1.2  2003/01/31 01:22:19  root
12    ##  + sub getLastPart
13    ##
14  ##  Revision 1.1  2003/01/19 03:27:36  joko  ##  Revision 1.1  2003/01/19 03:27:36  joko
15  ##  + initial check-in  ##  + initial check-in
16  ##  ## -------------------------------------------------------------------------
 ## ---------------------------------------------------------------------------  
17    
18    
19  package Data::Transform::String;  package Data::Transform::String;
# Line 16  use warnings; Line 24  use warnings;
24  require Exporter;  require Exporter;
25  our @ISA = qw( Exporter );  our @ISA = qw( Exporter );
26  our @EXPORT_OK = qw(  our @EXPORT_OK = qw(
27    stripHtml stripSpaces stripNewLines toReal trim    stripHtml stripNewLines toReal getLastPart trim
28  );  );
29    
30    
31    use Pitonyak::StringUtil qw( trim_space );
32    
33  sub stripHtml {  sub stripHtml {
34    my $html = shift;    my $html = shift;
35    my $result = '';    my $result = '';
# Line 36  sub stripHtml { Line 47  sub stripHtml {
47    return $result;    return $result;
48  }  }
49    
 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;  
 }  
   
50  sub trim {  sub trim {
51    my $string = shift;    trim_space(@_);
   return stripSpaces($string);  
52  }  }
53    
54  sub stripNewLines {  sub stripNewLines {
# Line 66  sub toReal { Line 67  sub toReal {
67    return $real;    return $real;
68  }  }
69    
70    sub getLastPart {
71      my $which = shift;
72      my $seperator = shift;
73      $seperator ||= '\/';
74      $which =~ m/^.*$seperator(.+?)$/;
75      return $1;
76    }
77    
78  1;  1;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.4

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed