Skip to content

Commit

Permalink
Fix fractional formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
sadellie committed Nov 26, 2023
1 parent d5775b2 commit cbb6331
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,15 @@ fun String.formatExpression(
return input.replace(Token.Digit.dot, formatterSymbols.fractional)
}

// Only format integral part
// Fractional
if (input.contains(Token.DisplayOnly.fraction)) {
val (integral, fraction) = input.split(" ")
return "${integral.formatNumber(formatterSymbols)} $fraction"
// Only format integral part
val splitFractional = input.split(" ")
if (splitFractional.size > 1) {
return "${splitFractional[0].formatNumber(formatterSymbols)} ${splitFractional[1]}"
}
// No integral part
return input
}

numbersRegex
Expand Down

0 comments on commit cbb6331

Please sign in to comment.