In extracted string, i am getting 4string variables which has value or empty.How to get string names whose value is empty

For eg,strings are like below
str1=“abc”
str2=“”
Str3=“def”
Str4=“”
I need to check if any string is empty or not and if it’s empty i want to fetch that empty variable names.
Can anyone please help?

Hi @vnsatyasunil ,

Do you want to get the name of the variable that matches the condition ?

If so, we would suggest to use a Dictionary approach for storing the values so that using the value, we could be able to get the Key name.

I’m not so sure about fetching the variable names based on the value provided.

Let us know more details about your use case which would help us understand the requirement more and thus provide/suggest a better solution.

I stored in dictionary variables only.how to check if string is empty or has value?

Hi @vnsatyasunil,

string.isNullorwhitespace(dic[key].Tostring())
string.isNullorEmpty(dic[key].Tostring())

You can use either one of the above code.

Thanks

For this expression continuation expected is coming.
In the same expression can we pass 4 variable names and get which variable has empty value

Thanks for replying.i have all string values only so dic new should be dictionary (string,string) right?
In if condition expression continuation expected coming

Yes,if str1 is key and abc is a value.

What is the error message?

) continuation expected

The code is in c# language.Are you created the workflow using vb?

Yes in vb changed accordingly

@vnsatyasunil change the portion of code in if condition as dicNew(item)

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