「VB.NET」文字列が空文字かどうかを判定する
書式
文字列 = String.Empty
使用例
Module Module1
Sub Main()
Dim strA As String = ""
Dim strB As String = "study"
Dim resA As Boolean = (strA = String.Empty)
Dim resB As Boolean = (strB = String.Empty)
Console.WriteLine(resA)
Console.WriteLine(resB)
Console.ReadKey()
End Sub
End Module
Module Module1
Sub Main()
Dim strA As String = ""
Dim strB As String = "study"
Dim resA As Boolean = (strA = String.Empty)
Dim resB As Boolean = (strB = String.Empty)
Console.WriteLine(resA)
Console.WriteLine(resB)
Console.ReadKey()
End Sub
End Module
Module Module1 Sub Main() Dim strA As String = "" Dim strB As String = "study" Dim resA As Boolean = (strA = String.Empty) Dim resB As Boolean = (strB = String.Empty) Console.WriteLine(resA) Console.WriteLine(resB) Console.ReadKey() End Sub End Module
結果
True
False