Just for fun
:))
if bigdecimal literal exists( Bigdecimal literal )
there will be easy way to get digit count.
static int integerDigits(BigDecimal n) {
n = n.stripTrailingZeros();
return n.precision() - n.scale();
}
So we can easyly make “||” operator:
def || (b:BigDecimal):Bigdecimal = {
v*integerDigits(b)+b
}
It will works for arbitrary numbers like 1000b || 0531b
:))
Seriously. I don’t think there is something better than string interpolation.
Unfortunately it doesn’t work with pattern matching.