2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-20 13:26:02 +00:00

10_ZWave.pm: Fix config shortening alg (Forum #34505)

git-svn-id: https://svn.fhem.de/fhem/trunk@8153 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2015-03-05 08:12:21 +00:00
parent 8646d7d5e9
commit 44148b0814

View File

@ -810,11 +810,17 @@ sub
ZWave_cleanString($$) ZWave_cleanString($$)
{ {
my ($c, $postfix) = @_; my ($c, $postfix) = @_;
my $shortened = 0;
$c =~ s/^[0-9.]+ //g; $c =~ s/^[0-9.]+ //g;
$c =~ s/Don.t/Dont/g; # Bugfix
if($c =~ m/^(.+)\.(.+)$/ && $2 !~ m/^[ \d]+$/) { # delete second sentence
$c = $1; $shortened++;
}
$c =~ s/[^A-Z0-9]+/ /ig; $c =~ s/[^A-Z0-9]+/ /ig;
$c =~ s/ *$//g;
$c =~ s/ (.)/uc($1)/gei; $c =~ s/ (.)/uc($1)/gei;
my $shortened=0; while(length($c) > 32 && $shortened < 999) {
while(length($c) > 32) { # might be endless loop
$c =~ s/[A-Z][^A-Z]*$//; $c =~ s/[A-Z][^A-Z]*$//;
$shortened++; $shortened++;
} }