I am writing a stored proc which is parsing string based on the delimiter and delimiter value is changing in each cycle to fetch the string left in every iteration. However, the loop never stops with the conditions provided. Code:
While (stringlength >0 && delimiterindex !=0)
{
Perform actions
}
I am unable to figure out what is the problem here. It should exit the loop as soon as all delimiter from string becomes 0. Eg. 'Stackoverflow is great'
After 2 iterations, the index will become 0 and I will be left with 'great' and loop should exit. But it's not happening.