VB.Net program to demonstrate the IsNullorWhitSpace() method of String class
'VB.NET program to demonstrate the IsNullOrWhiteSpace() method
'of String class.
Imports System
Module Module1
Sub Main()
Dim str1 As String = " "
Dim str2 As String = "Hello World"
Dim ret As Boolean
ret = String.IsNullOrWhiteSpace(str1)
If ret = True Then
Console.WriteLine("Strings str1 contains Null or only Whitespace")
Else
Console.WriteLine("Strings str1 does not contain Null or only Whitespace")
End If
ret = String.IsNullOrWhiteSpace(str2)
If ret = True Then
Console.WriteLine("Strings str2 contains Null or only Whitespace")
Else
Console.WriteLine("Strings str2 does not contain Null or only Whitespace")
End If
End Sub
End Module
Strings str1 contains Null or only Whitespace
Strings str2 does not contain Null or only Whitespace
Press any key to continue . . .
Table of Contents