blob: 39b0d781355918bd16032d6a780d1a2d0ba452bb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
/*
* Copyright (c) 2014 Contributor. All rights reserved.
*/
package scala.tools.nsc.classpath
import scala.tools.nsc.util.ClassPath.RootPackage
/**
* Common methods related to package names represented as String
*/
object PackageNameUtils {
/**
* @param fullClassName full class name with package
* @return (package, simple class name)
*/
def separatePkgAndClassNames(fullClassName: String): (String, String) = {
val lastDotIndex = fullClassName.lastIndexOf('.')
if (lastDotIndex == -1)
(RootPackage, fullClassName)
else
(fullClassName.substring(0, lastDotIndex), fullClassName.substring(lastDotIndex + 1))
}
def packagePrefix(inPackage: String): String = if (inPackage == RootPackage) "" else inPackage + "."
}
|