title: Split and Process a String in C++ into Different Variables
body: <p>I have a text file containing a bunch of data which is actually a student list.<br>
  The structure is like: "Name" "Telephone" "Gender" "StudentID" "Email"<br></p>
  
  <p>Here is a sample of the list:</p>
  
  <blockquote>
    <p>Roger Pont 70778745 M 20120345 hills@school.edu<br>
    Tommy Holness 5127438973 M 20120212 tommy@school.edu<br>
    Lee Kin Fong 864564456434 F 30245678 fong@school.edu<br></p>
  </blockquote>
  
  <p>The data is stored in  a text file and I have already used the getline() function to convert each line into a string.</p>
  
  <p>That is: student[0] contains "Roger Pont 7077874567 M 20120345 hills@school.edu"<br></p>
  
  <p>My task is to sort the records according to StudentID in ascending order.</p>
  
  <p>My problem is that I wanted to split the strings into different variable types.<br>
  However, since some names have more spaces in between and telephone number consists of different lengths, I can't use input and output streams is this way:<br>
  stream >> name[i] >> tel[i] >> gender[i] >> StudentID[i] >> email[i];</p>
  
  <p>Any ideas how I can split the strings into different variables?</p>
  
  <p>Thanks in advance.</p>
  
  <p>Remarks: I have read this (<a href="https://stackoverflow.com/questions/10194000/splitting-a-string-into-multiple-variables-in-c">Splitting a string into multiple variables in C++</a>) but unlike that case, I don't have a specific pattern such as having the word "age" before the integer that represents age.</p>