It is just logic: whole expression combined by and
is true
only when both parts are true
.
So when your loop met first :
character, expression is false
and loop has been stopped.
Based on your description, your code should look like
while (!(json[z-2] == 's' && json[z] == ':'))
{ z++; }
or equivalentely
while (json[z-2] != 's' || json[z] != ':')
{ z++; }
3
solved C# logical comparison with || or &&