title: Get the first half of a string in ruby
body: <p>I am trying to get the first half of a string. If the string length is an odd number, then round up. I am bit stuck on getting a half of a string.</p>
  
  <pre><code>def get_first_half_of_string(string)
    if string.size % 2 == 0
      string[1,4]
    else
      string[1,5]
    end
  end
  
  puts get_first_half_of_string("brilliant")
  </code></pre>
  
  <p>This returns rilli</p>