X-Git-Url: http://git.indexdata.com/?p=irspy-moved-to-github.git;a=blobdiff_plain;f=lib%2FZOOM%2FIRSpy%2FUtils.pm;h=0fc656aed69792025273e3a51f6a9d1f83b3fabe;hp=dfe4e9979121a6a526dc77f628d8b3447e34d1f9;hb=3d8efa47efc70e2d04f5c8325b2b72f0612f0dc2;hpb=9b3b58e46da3867cabcc6a6c54442ea2e6431f9a diff --git a/lib/ZOOM/IRSpy/Utils.pm b/lib/ZOOM/IRSpy/Utils.pm index dfe4e99..0fc656a 100644 --- a/lib/ZOOM/IRSpy/Utils.pm +++ b/lib/ZOOM/IRSpy/Utils.pm @@ -1,4 +1,3 @@ -# $Id: Utils.pm,v 1.38 2009-04-15 18:16:45 wosch Exp $ package ZOOM::IRSpy::Utils; @@ -10,6 +9,7 @@ use Scalar::Util; use Exporter 'import'; our @EXPORT_OK = qw(utf8param + trimField isodate xml_encode cql_quote @@ -105,6 +105,15 @@ sub isodate { $year+1900, $mon+1, $mday, $hour, $min, $sec); } +# strips whitespaces and start and ends of a field +sub trimField { + 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