how to use Switch with a string
<p>I have the code below that I wrote to get rid of a huge mess of if then else statements.  The only problem is, I just found out that the Switch statement cannot be used with a string.</p>

<p>Is there a trick to get around this?</p>

<p>Thanks</p>

<pre><code>switch(xpp.getName()) {
            case("creature") : attribID = Integer.parseInt(xpp.getAttributeValue(0));
            case("name") : elName = xpp.getName(); break;
            case("race") : elName = xpp.getName(); break;
            case("gender") : elName = xpp.getName(); break;
            case("alignment") : elName = xpp.getName(); break;
            case("age") : elName = xpp.getName(); break;
            case("condition") : elName = xpp.getName(); break;
            case("skinColor") : elName = xpp.getName(); break;
            case("hairColor") : elName = xpp.getName(); break;
            case("size") : elName = xpp.getName(); break;
            case("height") : elName = xpp.getName(); break;
            case("weight") : elName = xpp.getName(); break;
            case("hitPoints") : elName = xpp.getName(); break;
            case("armorClass") : elName = xpp.getName(); break;
            case("actionPoints") : elName = xpp.getName(); break;
            case("magicPoints") : elName = xpp.getName(); break;
            case("strength") : elName = xpp.getName(); break;
            case("dexterity") : elName = xpp.getName(); break;
            case("intelligence") : elName = xpp.getName(); break;
            case("weapon") : elName = xpp.getName(); break;
            case("armor") : elName = xpp.getName(); break;
            case("magicItem") : elName = xpp.getName(); break;
            case("attackSpell") : elName = xpp.getName(); break;
            case("defenseSpell") : elName = xpp.getName(); break;
            case("item1") : elName = xpp.getName(); break;
            case("item2") : elName = xpp.getName(); break;
        }
</code></pre>
