title: How to extract a substring from a string in C++?
body: <p>I've been looking thousand of questions and answers about what I'm going to ask, but I still didn't find the way to do what I'm gonna to explain.</p>
  
  <p>I have a text file from which I have to extract information about several things, all of them with the following format:</p>
  
  <pre><code>"string1":"string2"
  </code></pre>
  
  <p>And after that, there is more information, I mean:</p>
  
  <p>The text file is something like this:</p>
  
  <p>LINE 1
  XXXXXXXXXXXXXXXXXXXXXXXXXXXX"string1":"string2"XXXXXXXXXXXXXXXXXXXXXXXXXX"string3":"string4"XXXXXXXXXXXXXXXXXXXXXXXXXXXX...('\n')</p>
  
  <p>LINE 2
  XXXXXXXXXXXXXXXXXXXXXXXXXXXX"string5":"string6"XXXXXXXXXXXXXXXXXXXXXXXXXX"string7":"string8"XXXXXXXXXXXXXXXXXXXXXXXXXXXX...</p>
  
  <p>XXX represents irrelevant information I do not need, and theEntireString (string used in the code example) stores all the information of a single line, not all the information of the text file.</p>
  
  <p>I have to find first the content of string1 and store the content of string2 into another string without the quotes. The problem is that I have to stop when I reache the last quote and I don't know how exactly do this. I suppose I have to use the functions find() and substr(), but despite having tried it repeatedly, I did not succeed.</p>
  
  <p>What I have done is something like this:</p>
  
  <pre><code>string extractInformation(string theEntireString)
  {
    string s = "\"string1\":\"";    
    string result = theEntireString.find(s);
    return result;
  }
  </code></pre>
  
  <p>But this way I suppose I store into the string the last quote and the rest of the string.</p>