Uipath string null

Does anyone know how to check for an unassigned string in uipath? Uipath seems to crash when an if statement looks for a null string. Not sure how to handle that. String.empty doesn’t seem to work, and if the string is unassigned uipath stops logging and nothing happens.


You might just initialize or set the default value of the variable to “”
Then, it will have something stored in it.

You could also use = Nothing, I believe, but adds slight complexity.

If it’s empty then it sets the condition to False and if it’s not empty, it performs the condition.

1 Like

bool result = String.IsNullOrEmpty(yourString)


I constantly get the error that the index was outside the bounds of the array, because it returns an empty string. Do you know how to fix this?Capture

1 Like

Solved. Worked for me