title: Extract string before "|"
body: <p>I have a data set wherein a column looks like this:</p>
  
  <pre><code>ABC|DEF|GHI,  
  ABCD|EFG|HIJK,  
  ABCDE|FGHI|JKL,  
  DEF|GHIJ|KLM,  
  GHI|JKLM|NO|PQRS,  
  BCDE|FGHI|JKL  
  </code></pre>
  
  <p>.... and so on  </p>
  
  <p>I need to extract the characters that appear before the first <code>|</code> symbol.  </p>
  
  <p>In Excel, we would use a combination of MID-SEARCH or a LEFT-SEARCH, R contains <code>substr()</code>.</p>
  
  <p>The syntax is - <code>substr(x, &lt;start&gt;,&lt;stop&gt;)</code>  </p>
  
  <p>In my case, start will always be 1. For stop, we need to search by <code>|</code>. How can we achieve this? Are there alternate ways to do this?</p>