How to parse date string into integer variables?
<p>I have a <code>String</code> which is formatted like so: <code>"dd-MM-yyyy"</code>. I am trying to get the <code>dd</code> part of the string saved into a integer <code>day</code> variable. I want to do the same for the <code>MM</code> and <code>yyyy</code> parts of the <code>String</code>. I can imagine parsing the <code>String</code> using a for loop to separate the <code>String</code> whenever the <code>"/" char</code> is at the current index in the <code>for</code> loop.</p>

<p>How do I split the <code>String</code> containing the date into day, month and year respectively, into integer variables for me to operate on? Perhaps transferring this <code>String</code> to a <code>Date</code> object would make it easier due to a member method or field that handles this (just a thought). </p>