Java Path Convert To pathToPackageName(String relativeFileName, boolean leadingDot)

Here you can find the source of pathToPackageName(String relativeFileName, boolean leadingDot)

Description

path To Package Name

License

Apache License

Declaration

public static String pathToPackageName(String relativeFileName, boolean leadingDot) 

Method Source Code

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

public class Main {
    public static String pathToPackageName(String relativeFileName, boolean leadingDot) {
        return (!leadingDot && relativeFileName.startsWith("/") ? relativeFileName.substring(1) : relativeFileName)
                .replaceAll("/", ".");
    }/*w  w  w  .j a  va2  s  . c  o m*/
}

Related

  1. pathToFile(String f)
  2. pathToFullyQualifiedName(String classpath, String path)
  3. pathToName(String path)
  4. pathToName(String path, String fileName)
  5. pathTooLong()
  6. pathToQualifiedClassName(final String path)
  7. pathToQualifiedName(final String path)
  8. pathToResource(final String name)
  9. pathToSelfLink()