当 ctrl.Text 恰好是一个空字符串(值为 0)时,我得到了肯定的结果
这是正确的行为吗?我需要检查空字符串吗?
"Next|Prev|First|Last|Search".IndexOf(ctrl.Text) > -1
最佳答案
是的,在 msdn 中你会发现。
if value is String.Empty, the return value is 0.
关于c# - indexOf 查找空字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13327522/