title: Replacing multiple tokens with other strings
body: <p>I am translating FoxPro to C# and am having a hard time understanding how I can split a variable. My body has words that need to be swapped that are within "~". So for example, "~this~". Is there a C# equivelent to FoxPro's At()? Code below:</p>
  
  <pre><code>lnxx = At("~",lc_body,1)
          If lnxx = 0
              *--paste rest into new body
              lc_newbody = lc_newbody + lc_body
              Exit
          Endif
  
          *--get ending one
          lnyy = At("~",lc_body,2)
  
  
  
          *--get string out
          lc_string = Substr(lc_body,lnxx,lnyy-lnxx+1)
  
  
          *--remove ~
          lc_string = Strtran(lc_string,"~","")
  
  
          *--get part to ~, past in new one
          If lnxx&gt;1
              lc_substring = Substr(lc_body,1,lnxx-1)
              lc_newbody = lc_newbody + lc_substring
              *-cut to second ~
              lc_body = Substr(lc_body,lnyy+1,5000)
          Else
              *--it starts with ~, handle this case
              ***newbody is blank
              lc_newbody = ""
              *-cut to second ~
              lc_body = Substr(lc_body,lnyy+1,5000)
          Endif
  </code></pre>