title: how to delete from the last character at the end of a string, to a slash in the middle of a string?
body: <p>assuming,</p>
  
  <pre><code>string1 = "/var/usr/local/noob/"
  </code></pre>
  
  <p>i need to start from the last character to the closest "/" preceiding it.</p>
  
  <p>so i am expecting:</p>
  
  <pre><code>remove_last_block_of_string()
  </code></pre>
  
  <p>i should get</p>
  
  <blockquote>
    <p>"/var/usr/local/noob"</p>
  </blockquote>
  
  <p>if i run remove_last_block_of_string() again,</p>
  
  <pre><code>"/var/usr/local"
  </code></pre>
  
  <p>running it again,</p>
  
  <pre><code>"/var/usr"
  </code></pre>