code: public static String getExtension(String resourceName) {
  
          // if the resource name indicates a folder
          if (resourceName.charAt(resourceName.length() - 1) == '/') {
              // folders have no extensions
              return "";
          }
          // get just the name of the resource
          String name = CmsResource.getName(resourceName);
          // get the position of the last dot
          int pos = name.lastIndexOf('.');
          // if no dot or if no chars after the dot
          if ((pos < 0) || ((pos + 1) == name.length())) {
              return "";
          }
          // return the extension
          return name.substring(pos).toLowerCase();
      }
docs: Returns the extension of the given resource name, that is the part behind the last '.' char,
  converted to lower case letters.<p>
  
  The extension of a file is the part of the name after the last dot, including the dot.
  The extension of a folder is empty.
  All extensions are returned as lower case<p>
  
  Please note: No check is performed to ensure the given file name is not <code>null</code>.<p>
  
  Examples:<br>
  <ul>
  <li><code>/folder.test/</code> has an empty extension.
  <li><code>/folder.test/config</code> has an empty extension.
  <li><code>/strange.filename.</code> has an empty extension.
  <li><code>/document.PDF</code> has the extension <code>.pdf</code>.
  </ul>
  
  @param resourceName the resource to get the extension for
  
  @return the extension of a resource