title: How can I get multiple characters from a string?
body: <p>I'm trying to get the 5th, 6th and 7th digits from a list of digits.</p>
  
  <p>E.g. I want to get the year out of the variable <code>dateofbirth</code>, and save it as a separate variable called <code>dob</code>, as an <code>int</code>.</p>
  
  <p>Here is what I have:</p>
  
  <pre><code>int dateofbirth = 17031989
  String s = Integer.toString(dateofbirth);
  int dob = s.charAt(5);
  </code></pre>
  
  <p>What would I have to put in the parentheses after <code>s.charAt</code> to get a few digits in a row?</p>