Stay organized with collections
Save and categorize content based on your preferences.
Scale
open class Scale
A class that defines a quantity by which a number should be multiplied when formatting.
To create a Multiplier, use one of the factory methods.
Summary
Public methods |
open static Scale! |
Multiply numbers by an arbitrary value before formatting.
|
open static Scale! |
Multiply numbers by an arbitrary value before formatting.
|
open static Scale! |
Multiply a number by both a power of ten and by an arbitrary double value before formatting.
|
open static Scale! |
Do not change the value of numbers when formatting or parsing.
|
open static Scale! |
Multiply numbers by 100 before formatting.
|
Public methods
byBigDecimal
open static fun byBigDecimal(multiplicand: BigDecimal!): Scale!
Multiply numbers by an arbitrary value before formatting. Useful for unit conversions.
This method takes a BigDecimal; also see the version that takes a double.
Return |
Scale! |
A Multiplier for passing to the setter in NumberFormatter. |
byDouble
open static fun byDouble(multiplicand: Double): Scale!
Multiply numbers by an arbitrary value before formatting. Useful for unit conversions.
This method takes a double; also see the version that takes a BigDecimal.
Return |
Scale! |
A Multiplier for passing to the setter in NumberFormatter. |
byDoubleAndPowerOfTen
open static fun byDoubleAndPowerOfTen(
multiplicand: Double,
power: Int
): Scale!
Multiply a number by both a power of ten and by an arbitrary double value before formatting.
Return |
Scale! |
A Multiplier for passing to the setter in NumberFormatter. |
none
open static fun none(): Scale!
Do not change the value of numbers when formatting or parsing.
Return |
Scale! |
A Multiplier to prevent any multiplication. |
powerOfTen
open static fun powerOfTen(power: Int): Scale!
Multiply numbers by 100 before formatting. Useful for combining with a percent unit:
NumberFormatter.with().unit(NoUnit.PERCENT).multiplier(Multiplier.powerOfTen(2))
Return |
Scale! |
A Multiplier for passing to the setter in NumberFormatter. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# Scale\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nScale\n=====\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/icu/number/Scale \"View this page in Java\") \n\n```\nopen class Scale\n```\n\n|---|-------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.icu.number.Scale](#) |\n\nA class that defines a quantity by which a number should be multiplied when formatting.\n\nTo create a Multiplier, use one of the factory methods.\n\nSummary\n-------\n\n| Public methods ||\n|-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open static [Scale](#)! | [byBigDecimal](#byBigDecimal(java.math.BigDecimal))`(`multiplicand:` `[BigDecimal](../../../java/math/BigDecimal.html#)!`)` Multiply numbers by an arbitrary value before formatting. |\n| open static [Scale](#)! | [byDouble](#byDouble(kotlin.Double))`(`multiplicand:` `[Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html)`)` Multiply numbers by an arbitrary value before formatting. |\n| open static [Scale](#)! | [byDoubleAndPowerOfTen](#byDoubleAndPowerOfTen(kotlin.Double,%20kotlin.Int))`(`multiplicand:` `[Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html)`, `power:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Multiply a number by both a power of ten and by an arbitrary double value before formatting. |\n| open static [Scale](#)! | [none](#none())`()` Do not change the value of numbers when formatting or parsing. |\n| open static [Scale](#)! | [powerOfTen](#powerOfTen(kotlin.Int))`(`power:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Multiply numbers by 100 before formatting. |\n\nPublic methods\n--------------\n\n### byBigDecimal\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen static fun byBigDecimal(multiplicand: BigDecimal!): Scale!\n```\n\nMultiply numbers by an arbitrary value before formatting. Useful for unit conversions.\n\nThis method takes a BigDecimal; also see the version that takes a double.\n\n| Return ||\n|-------------|------------------------------------------------------------|\n| [Scale](#)! | A Multiplier for passing to the setter in NumberFormatter. |\n\n**See Also**\n\n- [android.icu.number.NumberFormatter](/reference/kotlin/android/icu/number/NumberFormatter) \n\n### byDouble\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen static fun byDouble(multiplicand: Double): Scale!\n```\n\nMultiply numbers by an arbitrary value before formatting. Useful for unit conversions.\n\nThis method takes a double; also see the version that takes a BigDecimal.\n\n| Return ||\n|-------------|------------------------------------------------------------|\n| [Scale](#)! | A Multiplier for passing to the setter in NumberFormatter. |\n\n**See Also**\n\n- [android.icu.number.NumberFormatter](/reference/kotlin/android/icu/number/NumberFormatter) \n\n### byDoubleAndPowerOfTen\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen static fun byDoubleAndPowerOfTen(\n multiplicand: Double, \n power: Int\n): Scale!\n```\n\nMultiply a number by both a power of ten and by an arbitrary double value before formatting.\n\n| Return ||\n|-------------|------------------------------------------------------------|\n| [Scale](#)! | A Multiplier for passing to the setter in NumberFormatter. |\n\n**See Also**\n\n- [android.icu.number.NumberFormatter](/reference/kotlin/android/icu/number/NumberFormatter) \n\n### none\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen static fun none(): Scale!\n```\n\nDo not change the value of numbers when formatting or parsing.\n\n| Return ||\n|-------------|---------------------------------------------|\n| [Scale](#)! | A Multiplier to prevent any multiplication. |\n\n**See Also**\n\n- [android.icu.number.NumberFormatter](/reference/kotlin/android/icu/number/NumberFormatter) \n\n### powerOfTen\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen static fun powerOfTen(power: Int): Scale!\n```\n\nMultiply numbers by 100 before formatting. Useful for combining with a percent unit: \n\n```kotlin\nNumberFormatter.with().unit(NoUnit.PERCENT).multiplier(Multiplier.powerOfTen(2))\n \n```\n\n\u003cbr /\u003e\n\n| Return ||\n|-------------|------------------------------------------------------------|\n| [Scale](#)! | A Multiplier for passing to the setter in NumberFormatter. |\n\n**See Also**\n\n- [android.icu.number.NumberFormatter](/reference/kotlin/android/icu/number/NumberFormatter)"]]