CorString: IsNullOrWhiteSpace |
Returns if the string is null, empty or contains only white-space characters.
Public Function IsNullOrWhiteSpace( ByRef s As String ) As Boolean
IsNullOrWhiteSpace is a convenience method that is similar to the following code, except that it offers better performance:
Len(CorString.Trim(s)) = 0
White-space characters are defined by the Unicode standard. The IsNullOrWhiteSpace method interprets any character that returns a value of true when it is passed to the Char.IsWhiteSpace method as a white-space character.
The following example creates a string array, and then passes each element of the array to the IsNullOrWhiteSpace method.
Public Sub Main() Dim Values() As String Dim Value As Variant Values = NewStrings(vbNullString, "", "ABCDE", Space$(20), t(" \t "), String$(&H2000, 10)) For Each Value In Values Debug.Print CorString.IsNullOrWhiteSpace(CStr(Value)) Next End Sub ' The code produces the following output. ' ' True ' True ' False ' True ' True ' True