Java Split into 3 Fields
<p>I have a String that looks like <strong>"NAME:City~FORMAT:S~PRINT:true"</strong></p>

<p>I want to split and assign the value of "City" to field1, "S" to field2, and true to field3 (Boolean).</p>

<p>I know I can grind through this code with brute force, but is there a way to parse the value of the 2nd split into the fields without doing some sort of check on a subscript to see if it is an odd value (e.g. subscript 0 is the NAME, but I want subscript 1, which is "City").</p>

<pre><code>   for (String element : text.split("~")) {
        for (String rule : element.split(":")) {
            System.out.println(rule);
        }

    }
</code></pre>
