如何在PowerShell中检查字符串是否为空或为空? [英] How can I check if a string is null or empty in PowerShell?

查看:1540
本文介绍了如何在PowerShell中检查字符串是否为空或为空?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在PowerShell中是否有类似于 IsNullOrEmpty 的内置函数,用于检查字符串是否为空或空?

Is there a built-in IsNullOrEmpty-like function in order to check if a string is null or empty, in PowerShell?

到目前为止,我找不到它,如果有内置的方法,我不想为此编写函数。

I could not find it so far and if there is a built-in way, I do not want to write a function for this.

推荐答案

您可以使用 IsNullOrEmpty 静态方法:

[string]::IsNullOrEmpty(...)

这篇关于如何在PowerShell中检查字符串是否为空或为空?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆