Android File Extension Name Get indexOfExtension(String filename)

Here you can find the source of indexOfExtension(String filename)

Description

index Of Extension

License

Apache License

Declaration

private static int indexOfExtension(String filename) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    private static int indexOfExtension(String filename) {
        if (filename == null) {
            return -1;
        }// www . j av  a  2 s.  c  o m
        int extensionPos = filename.lastIndexOf(".");
        int lastSeparator = filename.lastIndexOf("/");
        return (lastSeparator > extensionPos ? -1 : extensionPos);
    }
}

Related

  1. getFilenameExtension(String path)
  2. getNameMinusExtension(File file)
  3. getPathExtension(final String path)
  4. getSuffix(String f)
  5. hasExtension(String filename, String extension)
  6. isValidFileExtension(String extension)
  7. parseFileExtension(String filename)
  8. parseFileExtension(String filename)
  9. removeExtension(String file)