8 lines
No EOL
152 B
Kotlin
8 lines
No EOL
152 B
Kotlin
package fi.schro.util
|
|
|
|
import kotlin.math.max
|
|
import kotlin.math.min
|
|
|
|
fun Int.clamp(start: Int, end: Int): Int {
|
|
return min(end, max(start, this))
|
|
} |