title: How to check in xquery if a string has double quote in it?
body: <p>I am new to xQuery , trying to write xquery snippets in oracle osb and want to check if my query term is bounded by double quote. I have the code like below, but fn:replace or fn:contains is not working. 
  My input string , qt = "test", then it is a phrase if qt = test, then it is simple</p>
  
  <h2>How can I make this work ?</h2>
  
  <pre><code>if ($qt != "") 
  
  then let $newQt := fn:replace($qt,'"','\\"')
  
       return
       (    
        if (fn:contains($newQt,'\\"')) 
  
        then &lt;stan:query&gt; 
  
                &lt;stan:queryTerm&gt;{
                    fn:concat('string("',
                              $newQt,
                              '", mode="phrase", annotation_class="user")'
                    )
               }&lt;/stan:queryTerm&gt;   
  
               &lt;stan:mode&gt;{'RAW'}&lt;/stan:mode&gt;
  
             &lt;/stan:query&gt;
  
        else &lt;stan:query&gt; 
  
               &lt;stan:queryTerm&gt;{
                   fn:concat(
                      'string("',
                      $newQt,
                      '", mode="simpleany", annotation_class="user")'
                   )
               }&lt;/stan:queryTerm&gt;   
  
               &lt;stan:mode&gt;{'RAW'}&lt;/stan:mode&gt;
  
             &lt;/stan:query&gt;
  
       )
  
  else &lt;stan:query&gt; 
  
         &lt;stan:queryTerm&gt;{$newQt}&lt;/stan:queryTerm&gt;
  
         &lt;stan:mode&gt;{'AND'}&lt;/stan:mode&gt;
  
       &lt;/stan:query&gt;
  </code></pre>