Returning switch capable value based on String
<p>Not sure how I'm going to attack this.</p>

<p>Basically what I have is input of varying length, one or multiple times, that will cause an action. It being from typed input, file etc.</p>

<p>I have no idea on by what and how to tackle this. Would it be best to have a function returning an <code>int</code> that correspond to an <code>public static final int FOO = 1;</code>, an <code>enum</code>, an other way?</p>

<p>What I have as of now is a series of if statements as in:</p>

<pre><code>if (str.equals("foo") || str.equals("F")) {
      blah;
} else if (str.equals("beach")) {
      more blah;
}
</code></pre>

<p>Is this good as any, or is there a better way? Have had a peek at <code>enum</code> but seems like that is more to it then in e.g. C. This is probably wrong, but would it be something in the direction of this?</p>

<pre><code>class Mother
{

    HappyCamping() {
        switch (ValInput(str)) {
        case FOO: do fo; break;
        case BAR: do bar; break;
        case BAZ: do fo bar: break
        ...
    }

    private enum ValInput(String str)
    {
         FOO("foo"), BAR("bar"), BAZ("baz");

         private int value;

         private ValInput(String str) {
              if (str.equals("blah"))
                   this.value = 1;
              ...
         }
    }
}
</code></pre>

<p>Point being having a cleaner approach and separate out the "parsing" from the main routine. What would be a good way here?</p>
