I am writing a string to excel using the WriteCell as “string.Trim”. Now need to add a check whether its not null. Is it possible without using if condition?
1 Like
I think you are trying to check if the string is null or blank after trimming.
There is String.IsNullOrEmpty, but the principle is different.
str.Trim returns the character with whitespace removed.
(NameSpace) String.IsNullOrEmpty returns True or False whether it is blank or not.
string.IsNullOrEmpty(yourString)
this will return if it has empty value you can use this condition and proceed on Else part
cheers
@antony_tina