检查空字符串 [英] Checking for A Blank String
问题描述
我有一个if语句无法正常工作,我想知道我如何检查空白字符串。
我的代码示例
如果me.fieldname(arrayIndex)=""然后
-----
结束如果
当我这样做并且变量中没有字符时它会不要像我认为的那样输入我的IF语句
。如何正确检查
空白变量?
I have an if statement that isn''t working correctly and I was wondering how I
check for a blank string.
My Code Example
if me.fieldname(arrayIndex) = "" then
-----
end if
When I do this and there is no characters in the variable it does not enter
my IF statement like I would think it should. How do I properly check for a
blank variable?
推荐答案
您可以尝试使用string.IsNullOrEmpty方法进行测试你的
字符串为空或空。
==============
Clay Burch
Syncfusion,Inc。
You might try using the string.IsNullOrEmpty method to test your
string for null or empty.
==============
Clay Burch
Syncfusion, Inc.
你在做什么是正确的。更多的VB方法是检查字符串
String.Empty。
如果它没有输入if代码那么除了 "或者
String.Empty在现场。
Lloyd Sheen
" Playa" < Pl *** @ discussion.microsoft.com写信息
新闻:CB ************************* ********* @ microsof t.com ...
What you are doing is correct. A more VB way is to check the string against
String.Empty.
If it is not entering the if code then there is something other than "" or
String.Empty in the field.
Lloyd Sheen
"Playa" <Pl***@discussions.microsoft.comwrote in message
news:CB**********************************@microsof t.com...
>我有一个if语句无法正常工作我是想知道怎么
检查一个空字符串。
我的代码示例
if me.fieldname(arrayIndex )=""然后
-----
结束如果
当我这样做并且变量中没有字符时它会没有
输入
我的IF语句就像我认为的那样。我如何正确检查
a
空白变量?
>I have an if statement that isn''t working correctly and I was wondering how
I
check for a blank string.
My Code Example
if me.fieldname(arrayIndex) = "" then
-----
end if
When I do this and there is no characters in the variable it does not
enter
my IF statement like I would think it should. How do I properly check for
a
blank variable?
3月9日上午10点45分,Playa< P ... @ discussion.microsoft.comwrote:
On Mar 9, 10:45 am, Playa <P...@discussions.microsoft.comwrote:
我有一个if语句无法正常工作,我想知道我如何检查空白字符串。
我的代码示例
如果me.fieldname(arrayIndex)=""然后
-----
结束如果
当我这样做并且变量中没有字符时它会不要像我认为的那样输入我的IF语句
。如何正确检查
空白变量?
I have an if statement that isn''t working correctly and I was wondering how I
check for a blank string.
My Code Example
if me.fieldname(arrayIndex) = "" then
-----
end if
When I do this and there is no characters in the variable it does not enter
my IF statement like I would think it should. How do I properly check for a
blank variable?
如何正确检查空白变量?
How do I properly check for a blank variable?
您要检查空白变量还是空白字符串?如果前者
使用myVar不是后者你应该使用
String.IsNullOrEmpty(myStringVar)
谢谢,
Seth Rowe
Are you checking for a blank variable or blank string? If the former
use myVar is nothing the latter you should use
String.IsNullOrEmpty(myStringVar)
Thanks,
Seth Rowe
这篇关于检查空字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!