title: Remove a ending character from each line on Ruby
body: <p>So it reads from a online source file
  the string look like this,</p>
  
  <pre><code>1. this is line1.X
  2. this is "line2X"
  3. this is X line4.
  4. this is line3.X.X
  </code></pre>
  
  <p>So I only wants to put out the whole string with the ending "X" removed. In this example, only the X at the end of line 1 and line 4 will be removed.
  I used chomp, but it only removed the X in line4.</p>
  
  <pre><code>string.each_line { |line| line.chomp("X") }
  </code></pre>
  
  <p>Should I use chomp or use something else? </p>