String is null ,empty and zero

Hi All,
I have an value in string ,and i want to check it is null, empty or zero.
so,when string is null or empty that time I use string.IsNullorEmpty(Variablename)
but, for zero checking I am getting error.
kindly, suggest me

Regards,
Meenakshi

1 Like

Hi
String.Isnullorempty method will check only for null value or empty
while zero is different from null
for zero it should be like
StringVariable.ToString.Equals(“0”)

Cheers @Meenakshi6246

for zero its not working

1 Like

Kindly try this and let know for any queries or clarification or
if we want both together to be validated
then
string.IsNullorEmpty(yourvariable) or yourvariable.ToString.Equals(“0”)

Cheers @Meenakshi6246

1 Like

@Meenakshi6246 You can check two coditions string.IsNullorEmpty(Variablename) or Variablename.ToString="0"

did that work buddy
Cheers @Meenakshi6246

yes,
Thank you

1 Like

Fantastic
Cheers @Meenakshi6246