From a9edbfe34c17c7e7c854758f7bb2675e5059a9ef Mon Sep 17 00:00:00 2001 From: acli Date: Tue, 17 Feb 2004 07:26:29 +0000 Subject: [PATCH] Allow trim to return the trimmed whitespace if the caller wants them. --- misc/translator/TmplTokenizer.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/misc/translator/TmplTokenizer.pm b/misc/translator/TmplTokenizer.pm index bd32cf08e3..8c7db7cd7f 100644 --- a/misc/translator/TmplTokenizer.pm +++ b/misc/translator/TmplTokenizer.pm @@ -404,9 +404,8 @@ sub blank_p ($) { sub trim ($) { my($s) = @_; - $s =~ s/^(?:\s|\ $re_end_entity)+//os; - $s =~ s/(?:\s|\ $re_end_entity)+$//os; - return $s; + $s =~ /^(\s|\ $re_end_entity)*(.*)(\s|\ $re_end_entity)*$/os; + return wantarray? ($2, $1, $3): $2; } ############################################################################### -- 2.39.5