mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 07:50:31 +05:30
Format file.
This commit is contained in:
parent
24e31c4efb
commit
87c52f7e58
@ -4,19 +4,19 @@ import java.math.BigDecimal
|
|||||||
import java.math.RoundingMode
|
import java.math.RoundingMode
|
||||||
|
|
||||||
fun Long?.formatShort(): String = when {
|
fun Long?.formatShort(): String = when {
|
||||||
this!!<1000 -> {
|
this!! < 1000 -> {
|
||||||
this.toString()
|
this.toString()
|
||||||
}
|
}
|
||||||
this in 1000..999999 -> {
|
this in 1000..999999 -> {
|
||||||
val decimal = BigDecimal(this/1000).setScale(0, RoundingMode.HALF_EVEN)
|
val decimal = BigDecimal(this / 1000).setScale(0, RoundingMode.HALF_EVEN)
|
||||||
decimal.toString()+"K"
|
decimal.toString() + "K"
|
||||||
}
|
}
|
||||||
this in 1000000..10000000 -> {
|
this in 1000000..10000000 -> {
|
||||||
val decimal = BigDecimal(this/1000000).setScale(0, RoundingMode.HALF_EVEN)
|
val decimal = BigDecimal(this / 1000000).setScale(0, RoundingMode.HALF_EVEN)
|
||||||
decimal.toString()+"M"
|
decimal.toString() + "M"
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
val decimal = BigDecimal(this/1000000).setScale(0, RoundingMode.HALF_EVEN)
|
val decimal = BigDecimal(this / 1000000).setScale(0, RoundingMode.HALF_EVEN)
|
||||||
decimal.toString()+"M"
|
decimal.toString() + "M"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user