Skip to content

Commit

Permalink
Succinct pluralize.
Browse files Browse the repository at this point in the history
Co-authored-by: Mikołaj Kondratek <mik.kondratek@gmail.com>
  • Loading branch information
dominiccooney and mkondratek committed May 9, 2024
1 parent f7e95f1 commit e6973de
Showing 1 changed file with 4 additions and 7 deletions.
Expand Up @@ -108,10 +108,7 @@ class ContextFilesPanel(
}

// Can pluralize "file" and "line" by adding -s
private fun String.pluralize(count: Int): String {
return if (count == 1) {
this
} else {
"${this}s"
}
}
private fun String.pluralize(count: Int): String = when {
count == 1 -> this
else -> "${this}s"
}

0 comments on commit e6973de

Please sign in to comment.