Inspection Details

EmptyStringLiteral


Summary
Flags uses of an empty string literal ("").
Reasoning
Standard library constant 'vbNullString' is more explicit about its intent, and should be preferred to a string literal. While the memory gain is meaningless, an empty string literal still takes up 2 bytes of memory, but 'vbNullString' is a null string pointer, and doesn't.
The following code example(s) would trigger this inspection:

Public Sub DoSomething(ByVal foo As String)
    If foo = "" Then
        ' ...
    End If
End Sub

The following code example(s) would not trigger this inspection:

Public Sub DoSomething(ByVal foo As String)
    If foo = vbNullString Then
        ' ...
    End If
End Sub


Back to List