I have a large string, and a part of this string starts like this:
data-json="{"id":
and ends like this:
"}}}"
I am using the IndexOf method to find positions of data-json=" and the " in the end of the string.
However, when trying to find the index of the ", I get the index of the first " instead (in the string in the top of the post).
How can I make the IndexOf method distinguish between " and "?
This is how I search for the ":
string.IndexOf("\"", startIndex);
Of course maybe it could be possible to search for }}}" instead, but now I’m curious how to make the IndexOf method behave like I want it to.
This is embarrassing, please forgive my rookie mistake:
The startIndex used in the IndexOf method was simply wrong (it found the
"indata-json="because the startIndex value was too small).