title: Ignoring ALL parts of a string before a space
body: <p>I'm writing a small chat-bot program in C++</p>
  
  <p>Right now I have functionality for the robot to write whatever the user says to a file <code>brain.txt</code>, and places a number next to it in the file in order of when it was remembered. Continuing on, entering the userinput <code>Grapefruit</code> would put grapefruit on a new line, and a <code>6</code> as a prefix.</p>
  
  <pre><code>0 suspect
  1 interest
  2 underwood
  3 interior
  4 bullet
  5 dog
  </code></pre>
  
  <p>I've ran into an issue where I need to <em>compare</em> the userinput with a memory the bot <strong>already has</strong> from previous userinput's.</p>
  
  <pre><code>ifstream brain ("projects/AI/brain.txt");
  if (brain.is_open())
  {
      while ( getline(brain,memory))
      {
          cout &lt;&lt; "memory: " &lt;&lt; memory &lt;&lt; endl; 
          cout &lt;&lt; "userinput: " &lt;&lt; userinput &lt;&lt; endl; 
          if (memory == userinput)
              {
                  exists = true;
                  //if it exists, tell the user, and break
                  cout &lt;&lt; "I know that already!" &lt;&lt; endl;
                  break;
              }
          else { filepos++; }
  </code></pre>
  
  <p>If the userinput was <code>grapefruit</code> the bot's memory is <code>6 grapefruit</code> ergo if it was comparing these two the comparison check would fail, as they're not the same string. </p>
  
  <p>I want numbers to remain a part of the string and for me to be able to selectively choose parts of the string to read. I may upgrade to JSON or something similar later, but for right now, this is the way I'd like to do this.</p>
  
  <ul>
  <li><p>my first question is, how can i ignore ALL of the string until after a space? so my program will correctly compare <code>grapefruit</code> and <code>grapefruit</code> instead of <code>6 grapefruit</code></p></li>
  <li><p>my second question is, can I expand this functionality so that I can skip <em>multiple</em> spaces and only read after multiple spaces have passed? </p></li>
  </ul>
  
  <p>for example, in the string:
  6 Grapefruit 23 53 12
   I want to access the number 53, and nothing else.</p>
  
  <p>Ways to improve this and ways I've maybe done this incorrectly?</p>
  
  <p>I could've lifted this into say, a vector of tuples or something at runtime at program startup and that stops me from accessing from a file. This is something I may do in the future.</p>