coerceIn
Function
Common
fun TextRange.coerceIn(minimumValue: Int, maximumValue: Int): TextRange
Ensures that TextRange.start
and TextRange.end
values lies in the specified range
minimumValue
and maximumValue
. For each TextRange.start
and TextRange.end
values:
- if value is smaller than
minimumValue
, value is replaced byminimumValue
- if value is greater than
maximumValue
, value is replaced bymaximumValue
Parameters
minimumValue | the minimum value that TextRange.start or TextRange.end can be. |
maximumValue | the exclusive maximum value that TextRange.start or TextRange.end can be. |