diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-09-29 22:41:30 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-09-29 22:41:30 +0200 |
commit | fb14b8b167d735760af2ff36de0fc173786833c7 (patch) | |
tree | c073709d2f3f23612923b39f67b6ee52b2485ae8 /src/main/java/at/hannibal2/skyhanni/utils | |
parent | 644fa5e1f1dce23a5cc7a0aff912bd49f318da69 (diff) | |
download | skyhanni-fb14b8b167d735760af2ff36de0fc173786833c7.tar.gz skyhanni-fb14b8b167d735760af2ff36de0fc173786833c7.tar.bz2 skyhanni-fb14b8b167d735760af2ff36de0fc173786833c7.zip |
NonGodPotEffectDisplay
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt index 52a58c4a6..aa4126de1 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt @@ -53,16 +53,16 @@ object StringUtils { val formatSeconds = durationFormat.format(sec) if (days > 0) { - return "${days}d $formatHours:$formatMinutes:$formatSeconds ago" + return "${days}d $formatHours:$formatMinutes:$formatSeconds" } if (hours > 0) { - return "$formatHours:$formatMinutes:$formatSeconds ago" + return "$formatHours:$formatMinutes:$formatSeconds".removeAtBeginning("0") } if (minutes > 0) { - return "$formatMinutes:$formatSeconds ago" + return "$formatMinutes:$formatSeconds".removeAtBeginning("0") } if (sec > 0) { - return "${sec}s ago" + return "${sec}s" } return "Now" @@ -88,4 +88,6 @@ object StringUtils { return toString().replace("-", "") } -}
\ No newline at end of file +} + +private fun String.removeAtBeginning(text: String): String = if (this.startsWith(text)) substring(text.length) else this |