「VB.NET」文字列が空文字かどうかを判定する

2021年10月6日

書式
文字列 = String.Empty
使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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

VB.net

Posted by arkgame