如何测试 $dbUserName 中的字符数是否超过八个字符?
我一直无法找到可以让我执行此操作的命令或一系列命令。我只能找到变量是否为空:
if ($dbUserName) {
Write-Output " You left Username blank"
$dbUserName = read-host
}
但我想像这样进行下一次测试:
if ($dbUserName [String] > 8 ) }
Write-Output " Please enter more than 8 characters "
$dbUserName=read-host " Re-enter database user name"
}