title: ruby start_with?(), end_with?()
body: <p>I have a document with subject headers being enclosed in "|" characters.</p>
  
  <p>E.g. "| LINKS |"</p>
  
  <p>I want to check the string if it begins and ends with "|" character to verify that the particular document's subject header is valid. How do I do so ?</p>
  
  <p>Source:</p>
  
  <pre><code>@filetarget = " &lt; document file location here &gt; "
  
  @line = ""
  
  file = File.new(@filetarget)
  
  while (@line = file.gets)
     if((@line.start_with?("|")) and (@line.end_with?("|")))
        puts "Putting: " + @line
     end
  end
  </code></pre>
  
  <p>Document text for parsing:</p>
  
  <pre><code>| LINKS |
  
  http://www.extremeprogramming.org/  &lt;1&gt;
  
  http://c2.com/cgi/wiki?ExtremeProgramming  &lt;2&gt;
  
  http://xprogramming.com/index.php  &lt;3&gt;
  
  | COMMENTS |
  
  * Test comment
  * Test comment 2
  * Test comment 3
  </code></pre>