title: Calling Method in Scala from User Input
body: <p>I have a user input:</p>
  
  <p><code>val method = """doReplace(doReplace("ab","a","x"),"b","y")"""</code></p>
  
  <p>How can I invoke this method at run-time using Scala:</p>
  
  <pre><code>object test2 {
  
    def doReplace(str: String, oldChar: String, newChar: String) = {
      str.replace(oldChar, newChar)
    }
  
    def main(args: Array[String]): Unit = {
  
      val method = """doReplace(doReplace("ab","a","x"),"b","y")"""
  
    }
  
  } 
  </code></pre>