Minor, use substringBeforeLast instead of hand-written code

This commit is contained in:
Alexander Udalov
2015-04-23 03:20:11 +03:00
parent 7e69c414d4
commit a0502d99f4
@@ -130,10 +130,7 @@ public object KotlinJavascriptSerializationUtil {
}
private fun getPackageName(filePath: String): String {
val lastIndexOfSep = filePath.lastIndexOf('/')
assert(lastIndexOfSep >= 0, "expected / in $filePath")
return filePath.substring(0, lastIndexOfSep).replace('/', '.')
return filePath.substringBeforeLast('/').replace('/', '.')
}
private fun getPackages(contentMap: Map<String, ByteArray>): List<String> =