# Parse String to Function

**URL:** https://discourse.julialang.org/t/parse-string-to-function/89668
**Category:** General Usage
**Created:** [November 2, 2022, 5:14pm UTC](https://discourse.julialang.org/t/parse-string-to-function/89668 "2022-11-02T17:14:48Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![CodeGodz](https://avatars.discourse-cdn.com/v4/letter/c/aeb1de/32.png) [@CodeGodz](https://discourse.julialang.org/u/CodeGodz)
#### Post date: [November 2, 2022, 5:30pm UTC](https://discourse.julialang.org/t/parse-string-to-function/89668/2 "2022-11-02T17:30:19Z")

</div>

You can use this:

```julia
using InverseLaplace
import InverseLaplace: talbot

f1 = eval(Meta.parse("f1(s) = s / (s^2 + 1)")) 
ft1 = Talbot(f1, 80);
ft1(pi / 2) 

```

To add a little bit more info. `Meta.parse` will “parse” the string to an expression. Then `eval` will evaluate the expression, basically “checking the value of the expression” (maybe [this](https://subscription.packtpub.com/book/application-development/9781785882012/2/ch02lvl1sec21/the-eval-function#:~:text=The%20eval()%20function%20is,done%20in%20a%20global%20scope.) makes it more clear). I moved the `f1(s)` within the string as it should be part of the expression.

There is a discussion [here](https://discourse.julialang.org/t/performance-of-meta-parse-and-eval/52061) about whether you should use expression parsing.

---

_[View the full topic](https://discourse.julialang.org/t/parse-string-to-function/89668)._
