I have three variables :
val months: Long
val days: Long
val hours: Long
and I want to return something like this :
3 months, 2 days and 5 hours
Now this would simply translate to as :
val str = "$months months, $days days and $hours hours"
And if my months had to be 0 and days as 1 and hours as 0 then it will come like '0 months, 1 days and 0 hours'
But what I am looking for is "1 days" instead. How can I get it done?
I can definitely use some sort of conditional StringBuilder to get this done, but is there something better and elegant?