Is it possible to translate a string with operators into an actual equation?

Let´s say I have the string a= "2+2" . So that class(a) = char. Is there a way to transform the string "2+2" into the actual equation a=2+2 so that the answer is a = 4???

Re: Is it possible to translate a string with operators into an actual equation?

On Tue, Sep 16, 2014 at 7:42 PM, bobkarh <[hidden email]> wrote:

Let´s say I have the string a= "2+2" . So that class(a) = char. Is there a
way to transform the string "2+2" into the actual equation a=2+2 so that the
answer is a = 4???

octave:1> a="2+2" a = 2+2 octave:2> a=eval(a) a = 4