[Solved] Unable to use substring and index of() to get the substring and put a null check on it [closed]


It’s very unclear what you want to do because on the one hand you mention you want to use Substring and IndexOf, and on the other hand, you put it on comment and say you want to check if it’s null, and which you’re already checking if the string customFolders is null or empty. I am very confused, but I can tell you that if you want to use String.IndexOf with 2 parameters (a string and an int), the int parameter has to be greater or equal to 0 and less than the string’s length because this parameter is the index of which it will start searching for the specified string.

Also if you try to execute the if statement that you posted, it will generate a compile error since you are giving the result of the IndexOf to the variable i, but what about the value of this? You do not check the value so the statement results an int value, but an if statement requires a boolean value.

Hopefully that helped you somewhat.

2

solved Unable to use substring and index of() to get the substring and put a null check on it [closed]