Saturday, October 3, 2015

Sample code: a method which gets the extension of a program

Sample code written in Java. This method gets what the program's extension is.


private static String getSuffix(String FileName) {
    if (FileName == null)
          return null;
       int point = FileName.lastIndexOf(".");
       if (point != -1) {
           return FileName.substring(point + 1);
       }
       return FileName;
   }