title: In Java String, How to cut a part of a String by just 1 line of code (probally use Regex)?
body: <p>given this string <code>http://verylongurlverylonngurl/image.jpg</code> &amp; I wanna cut all the part before the last "/". For example, I wanna remove the part <code>http://verylongurlverylonngurl/</code> of the string above. The result will be "image.jpg".</p>
  
  <p>I have to cut the String "Label" &amp; the code to cut that String must be inside the super() keyword &amp; super keyword must be the first statement in the constructor. Loook at this code:</p>
  
  <pre><code>private class TextShortenedCheckBox extends CheckBox{
        private String originalText;
         public TextShortenedCheckBox(String label, int visibleLength){
              super(label.substring(label.length()-9,label.length()-1));
  
  
              originalText=label;
  
         }
         @Override
         public String getText(){
            return originalText;
         }
      }
  </code></pre>
  
  <p>Look at the code: <code>label.substring(label.length()-9,label.length()-1)</code> this code give the result but not be able to apply for other variable string.</p>
  
  <p>So, how to cut a part of a String by just 1 line of code, so that I can put that code inside super(). Maybe we have to use Regex or something?</p>