Fix getting duplicate serial ports with null characters
The function toStringAndTrimNullCharacter() deletes only trailing zeroes
from right to left direction up to the first non-zero character were meet.
This can return the wrong string in case there are the zero characters to
the left of the non-zero characters.
We should look for the first zero-character from left to right direction,
and discard all right part of a string, including the zero-character.
Task-number: QTBUG-47127
Change-Id: I4d101b49bbb153bddbe535a920d616b5fef130e9
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>