Use utf8-friendly space symbols chop operation in trim()

This commit is contained in:
eleksir
2022-04-03 16:36:56 +03:00
parent 5e5613ff82
commit 8d4bf1abd9

View File

@@ -23,13 +23,8 @@ sub trim {
return $str; return $str;
} }
while (substr ($str, 0, 1) =~ /^\s$/xms) { $str =~ s/^\s+//;
$str = substr $str, 1; $str =~ s/\s+$//;
}
while (substr ($str, -1, 1) =~ /^\s$/xms) {
chop $str;
}
return $str; return $str;
} }