# Evaluating string

**URL:** <https://forum.kirupa.com/t/evaluating-string/170042>\
**Category:** Uncategorized\
**Created:** [November 22, 2005, 8:15am UTC](https://forum.kirupa.com/t/evaluating-string/170042 "2005-11-22T08:15:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mathew\_er](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mathew\_er](https://forum.kirupa.com/u/mathew_er)\
**Post date:** [November 22, 2005, 8:15am UTC](https://forum.kirupa.com/t/evaluating-string/170042/1 "2005-11-22T08:15:41Z")

</div>

Hi,  
I’d like to know one thing, that could make my life much easier. I need to evalueate a string as code… let me show you an example…

Lets say, that I have a string:

```auto
string = "Math.cos(var1)*Math.sin(var2)";

```

And what I need to do, it to use its contents as code and not string like here:

```auto
var3 = Math.cos(var1)*Math.sin(var2);
// but I need to use something like... I know(I think)
// that eval is not useable in this case
var3 = eval(string)

```

Any help wil be appreciated. 😃
