TP-54572 | two decimal allowed for amount (#9416)

This commit is contained in:
Saurabh Chaudhary
2024-01-19 11:33:39 +05:30
committed by GitHub
parent ec37e36757
commit db6aea2ebd
2 changed files with 3 additions and 3 deletions

View File

@@ -31,7 +31,7 @@ fun getAmountString(amount: Long, suffixShortForm: Boolean = true): String {
return firstString + if (suffixShortForm) CRORE_SHORT_FORM else CRORE_FULL_FORM
}
secondString =
amountText[amountLength - 7].toString() +
amountText.substring(amountLength - 7, amountLength - 5) +
if (suffixShortForm) CRORE_SHORT_FORM else CRORE_FULL_FORM
return "$firstString.$secondString"
} else if (amountLength > 5) {

View File

@@ -15,8 +15,8 @@ class HLUtilsTest {
assertEquals("54.5 L", getAmountString(5456756, true))
assertEquals("54.5 Lakhs", getAmountString(5456756, false))
assertEquals("5 Cr", getAmountString(50000000))
assertEquals("54.5 Cr", getAmountString(545675634, true))
assertEquals("54.5 Crores", getAmountString(545675634, false))
assertEquals("54.56 Cr", getAmountString(545675634, true))
assertEquals("54.56 Crores", getAmountString(545675634, false))
assertEquals("54 Crores", getAmountString(540000000, false))
}