From: Wolfram Schneider Date: Wed, 21 Apr 2010 13:22:51 +0000 (+0200) Subject: new helper function trimFields() X-Git-Tag: CPAN-v1.02~54^2~54 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=2b93d66ea851248a4fabdc70630248b5ae034125;p=irspy-moved-to-github.git new helper function trimFields() --- diff --git a/lib/ZOOM/IRSpy/Utils.pm b/lib/ZOOM/IRSpy/Utils.pm index 868639b..4f2580c 100644 --- a/lib/ZOOM/IRSpy/Utils.pm +++ b/lib/ZOOM/IRSpy/Utils.pm @@ -104,6 +104,15 @@ sub isodate { $year+1900, $mon+1, $mday, $hour, $min, $sec); } +# strips whitespaces and start and ends of fields +sub trimFields { + my $field = shift; + + $field =~ s/^\s+//; + $field =~ s/\s+$//; + + return $field; +} # I can't -- just can't, can't, can't -- believe that this function # isn't provided by one of the core XML modules. But the evidence all