The obvious first thought is:
Public Function CheckStrings(ByVal input As String()) As Boolean
For Each s As String In input
If s.Length > 0 Then Return True
Next
Return False
End Function
I’m sure there is a simpler way than that though. At least simpler in terms of the code if not necessarily the performance.
End result:
Well, you guys did a pretty good job of simplifying. Well done.
I think I’ll still use an extension to make it just that much simpler in the main code. The final result really isn’t too bad by itself though.
Here’s my final code:
<Extension()> _
Public Function AnyNonZero(ByVal value As String()) As Boolean
If Not value.All(Function(x) String.IsNullOrEmpty(x)) Then Return True
Return False
End Function
You can use this to return true if all elements are zero length.
Be careful of null references. You may want to use this instead: