检查动作脚本中的字符串是否为空,类似于.net中的String.Empty
Action中是否有一个类似于.net中String对象中的静态属性来检查字符串是否为空,那就是String.Empty。
谢谢
Is there a static property in Action similar to that in the String object in .net to check if a string is empty, that is String.Empty.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以简单地执行以下操作:
这有效,因为使用这些规则:
字符串-> Boolean = "如果值为 null 或空字符串 ( "" ),则为 false;否则为 true。"
You can simply do:
This works because the string is coerced to a boolean value using these rules:
String -> Boolean = "false if the value is null or the empty string ( "" ); true otherwise."
以下将捕获所有这些:
The following will catch all of these:
您可以使用
length
但这是一种普通属性而不是静态属性。您可以在此处找到该类的所有属性 String< /a>.如果长度为0
,则字符串为空。因此,如果您想区分null
字符串和空字符串,可以按如下方式进行测试:或者,如果您不需要区分空字符串和空字符串,则可以使用 Richie_W 的解决方案。
You can use
length
but that is a normal property not a static one. You can find here all the properties of of the class String. If length is0
the string is empty. So you can do your tests as follows if you want to distinguish between anull
String and an empty one:Or you can use Richie_W's solution if you don't need to distinguish between empty and null strings.