Part of string before a colon and then the part after the colon using a scanner
<p>Like the title says is it possible to read part of a String before a colon and then the rest of the String after the colon using a scanner?</p>

<p>If you have a String:  </p>

<pre><code>"AA:BigHouseOnTheBeach"
</code></pre>

<p>is it possible for me to store the first part <code>"AA"</code> in a separate String and <code>"BigHouseOnTheBeach"</code> in a second separate String?</p>

<p>Here's my code:</p>

<pre><code>public NumberPlates() {
    // opg 2a) initialiser districtMap
    districtMap = new HashMap&lt;String, String&gt;();
    readFile();
}

public void readFile() {
    file = new File("src/opg2_numberplates/Nummerplader.txt");

    try {
        Scanner reader = new Scanner(file);

        if (reader.hasNext()) {
            kb = reader.next();
            pk = reader.next();
            districtMap.put(kb, pk);
        }

    } catch (NullPointerException ex) {
        System.out.println("Null pointer");

    } catch (FileNotFoundException ex) {
        System.out.println("File not found");
    }
}
</code></pre>

<p>At the moment, it puts <code>"AA:BigHouseOnTheBeach"</code> and <code>"AB:SmallHouseOnTheBeach"</code> into my map as key and value. I want to put <code>"AA"</code> as key and <code>"BigHouseOnTheBeach"</code> as value.</p>