Condition to check if array is empty or null

Hi,

I want to check if the array of string called arr1 is empty or null…

I’m using
Arr1 is nothing in the condition and it’s not working fine…

Any idea?

Hi @Ray_Sha1

Use IsNothing(arraystr) OrElse arraystr.Length.Equals(0)

cheers

1 Like

Hi @Ray_Sha1,

Input
image

Output
image

String.Join(“”,arrVal) = Nothing

One more condition

String.IsNullOrEmpty(String.Join(“”,arrVal)) or String.IsNullOrWhiteSpace(String.Join(“”,arrVal))

Thanks,

1 Like

Hello @Ray_Sha1
You can use the below expression:

IsNothing(MyVar)

Else check the below similar post.

Thanks

1 Like

a very strict approach could

isNothing(yourArrVar) OrElse (Not yourArrVar.Any() ) OrElse yourArrVar.All(Function (x) String.IsNullOrEmpty(x.Trim()))

it will return true when the array is null, having no items or every entry is null or empty.String

2 Likes

Hiiii @Ray_Sha1 you can use arr1.count=0 in condition sooo that you can able to get empty array

image

1 Like

Hi all,

All of them are valid solutions.
I just selected one that I’m using as I’ll also verify the null, empty values.

Thanks all

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.