Skip to content

Commit

Permalink
Update KSNameImpl.kt
Browse files Browse the repository at this point in the history
Using lastIndexOf
  • Loading branch information
GeorgCantor authored Nov 9, 2024
1 parent 1df379c commit a506dd5
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ class KSNameImpl private constructor(val name: String) : KSName {
}

override fun getQualifier(): String {
return name.split(".").dropLast(1).joinToString(".")
val lastIndex = name.lastIndexOf('.')
return if (lastIndex != -1) name.substring(0, lastIndex) else ""
}

override fun getShortName(): String {
return name.split(".").last()
val lastIndex = name.lastIndexOf('.')
return if (lastIndex != -1) name.substring(lastIndex + 1) else name
}
}

0 comments on commit a506dd5

Please sign in to comment.