From: Wolfram Schneider Date: Wed, 21 Apr 2010 13:22:51 +0000 (+0200) Subject: new helper function trimFields() X-Git-Tag: CPAN-v1.02~109 X-Git-Url: http://git.indexdata.com/?p=irspy-moved-to-github.git;a=commitdiff_plain;h=e6f90536b01635b196212bc09fbd7477d5b01f0e;ds=inline 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