title: compare string with startWith in scala
body: <p>I want to compare a pattern in string </p>
  
  <pre><code>sealed trait Demo { def value: String }
  
     object Demo {
    case object TypeAB extends Demo {
      val value = "a:b"
    }
        .......other constants
  }
   val test = Option("a:b:c")
  val s =test.map(_.startsWith(Demo.TypeAB.value))
  </code></pre>
  
  <p>I want to not use <code>.value</code> in <code>Demo.TypeAB.value</code>
  Is there a better approach to achieve the above .I preferred to use <code>startsWith</code></p>
  
  <p>I tried but it didnot work</p>
  
  <pre><code> def unapply(arg: Demo): String= arg.value
  </code></pre>