Skip to content

Commit

Permalink
humCase to Hump Case formatter
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Smart <derek@grindaga.com>
  • Loading branch information
mcred committed Mar 12, 2019
1 parent 5c2c50a commit 6382564
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/main/kotlin/com/grindaga/crissaegrim/views/StatsView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ class StatsView : View("My View") {
}
}

private fun humpToCaps(hump: String): String {
var retString: String = ""
for (letter in hump) {
retString += when {
letter.isUpperCase() -> " $letter"
else -> letter
}
}
return retString.capitalize()
}

override val root = tabpane {
useMaxWidth = true

Expand Down Expand Up @@ -58,7 +69,7 @@ class StatsView : View("My View") {
for (relic in relics) {
val row: Int = count % 2
if (row == 0) {
field(relic.name) {
field(humpToCaps(relic.name)) {
togglegroup {
togglebutton("Not Found", this, true, 0)
togglebutton("Off", this, false, 1)
Expand All @@ -75,7 +86,7 @@ class StatsView : View("My View") {
for (relic in relics) {
val row: Int = count % 2
if (row == 1) {
field(relic.name) {
field(humpToCaps(relic.name)) {
togglegroup {
togglebutton("Not Found", this, true, 0)
togglebutton("Off", this, false, 1)
Expand Down

0 comments on commit 6382564

Please sign in to comment.