How to write If string is not empty

If myString is not “” doesn’t work, any suggestions

Hi @Aishwarya_Maggi ,

You can use String function:

String.IsNullOrEmpty(myString)

this will return Boolean value.

Regards,
Sasikumar K

1 Like

Hi,
Use like this,
StringVariable.trim <> ""

@Aishwarya_Maggi, use this: If not String.IsNullOrEmpty(myString). It will return a boolean value

Hi,

If you want to have a single line solution, then try like the following,

CStr(IIf(String.IsNullOrEmpty(“yourString”)), “Large”, “Small”))

@sarathi125, can you explain what the CStr does? Is it called within the invoke activity?

Hi,

the CStr is Type conversion function available in vb.net. Cstr is to convert the object to sting, here I have tried to write the result into WriteLine Activity so I have to convert it to string to write it.

for more details check here

Untitled

1 Like

Thanks. Understood.

1 Like