1 |
## --------------------------------------------------------------------------- |
## ------------------------------------------------------------------------- |
2 |
## $Id$ |
## $Id$ |
3 |
## --------------------------------------------------------------------------- |
## ------------------------------------------------------------------------- |
4 |
## $Log$ |
## $Log$ |
5 |
|
## Revision 1.3 2003/02/20 21:23:34 joko |
6 |
|
## using 'trim_space' from Pitonyak::StringUtil as a replacement for our 'trim' |
7 |
|
## |
8 |
|
## Revision 1.2 2003/01/31 01:22:19 root |
9 |
|
## + sub getLastPart |
10 |
|
## |
11 |
## Revision 1.1 2003/01/19 03:27:36 joko |
## Revision 1.1 2003/01/19 03:27:36 joko |
12 |
## + initial check-in |
## + initial check-in |
13 |
## |
## ------------------------------------------------------------------------- |
|
## --------------------------------------------------------------------------- |
|
14 |
|
|
15 |
|
|
16 |
package Data::Transform::String; |
package Data::Transform::String; |
21 |
require Exporter; |
require Exporter; |
22 |
our @ISA = qw( Exporter ); |
our @ISA = qw( Exporter ); |
23 |
our @EXPORT_OK = qw( |
our @EXPORT_OK = qw( |
24 |
stripHtml stripSpaces stripNewLines toReal trim |
stripHtml stripNewLines toReal getLastPart trim |
25 |
); |
); |
26 |
|
|
27 |
|
|
28 |
sub stripHtml { |
sub stripHtml { |
29 |
my $html = shift; |
my $html = shift; |
30 |
my $result = ''; |
my $result = ''; |
42 |
return $result; |
return $result; |
43 |
} |
} |
44 |
|
|
|
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; |
|
|
} |
|
|
|
|
45 |
sub trim { |
sub trim { |
46 |
my $string = shift; |
Pitonyak::StringUtil::trim_space(@_); |
|
return stripSpaces($string); |
|
47 |
} |
} |
48 |
|
|
49 |
sub stripNewLines { |
sub stripNewLines { |
62 |
return $real; |
return $real; |
63 |
} |
} |
64 |
|
|
65 |
|
sub getLastPart { |
66 |
|
my $which = shift; |
67 |
|
my $seperator = shift; |
68 |
|
$seperator ||= '\/'; |
69 |
|
$which =~ m/^.*$seperator(.+?)$/; |
70 |
|
return $1; |
71 |
|
} |
72 |
|
|
73 |
1; |
1; |