Fastest way to lookup a value associated with a string

Looking at this extremely complex example here:


var value:int;
var a:String=("dog");
var b:String=("cat");
var c:String=("bear");

decode(b);

function decode(string:String){
    if(string=="dog"){
        value=1;
    }else if(string=="cat"){
        value=2;
    }else if(string=="bear"){
        value=3;
    }
}


My goal is to simply feed in a string, and use the predefined corresponding integer i have associated.

I would like to know the absolute fastest way this is achieved.