PowerShell -Trim -Trailing -Räume

$result = $mystring.trim()
Mike Hsu