Check if a string is not NULL or EMPTY

前端 未结 6 1833
别跟我提以往
别跟我提以往 2020-12-15 15:38

In below code, I need to check if version string is not empty then append its value to the request variable.

if ([string]::IsNullOrEmpty($version))
{
    $re         


        
6条回答
  •  佛祖请我去吃肉
    2020-12-15 15:52

    if (-not ([string]::IsNullOrEmpty($version)))
    {
        $request += "/" + $version
    }
    

    You can also use ! as an alternative to -not.

提交回复
热议问题