fork(1) download
  1. import java.io.*;
  2.  
  3. class Ideone {
  4. public static void main (String[] args) {
  5. String dirPath = "/home/daniela/oknok/data/uploads/23980dc32e16792007de3343f1f99211/";
  6. System.out.println(dirPath.substring(dirPath.substring(0, dirPath.length() - 1).lastIndexOf("/")));
  7. System.out.println(new File(dirPath).getName());
  8. System.out.println("/" + new File(dirPath).getName() + "/");
  9. }
  10. }
Success #stdin #stdout 0.06s 380224KB
stdin
Standard input is empty
stdout
/23980dc32e16792007de3343f1f99211/
23980dc32e16792007de3343f1f99211
/23980dc32e16792007de3343f1f99211/