From e6f90536b01635b196212bc09fbd7477d5b01f0e Mon Sep 17 00:00:00 2001 From: Wolfram Schneider Date: Wed, 21 Apr 2010 15:22:51 +0200 Subject: [PATCH] new helper function trimFields() --- lib/ZOOM/IRSpy/Utils.pm | 9 +++++++++ 1 file changed, 9 insertions(+) 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 -- 1.7.10.4