728x90
val num = 123.456
println(num.roundToInt())
println(num.roundToLong())
Output
123
123
728x90
'Kotlin' 카테고리의 다른 글
[kotlin] 부분 문자열 추출(슬라이싱) (0) | 2020.12.19 |
---|---|
[kotlin] 배열 뒤집기 - reverse(), reversed(), reversedArray() (0) | 2020.12.19 |
[Kotlin] 코틀린 표준 라이브러리 let(), also(), apply(), run(), with() - (3) (0) | 2020.07.22 |
[Kotlin] 코틀린 표준 라이브러리 let(), also(), apply(), run(), with() - (2) (0) | 2020.07.22 |
[Kotlin] 코틀린 표준 라이브러리 let(), also(), apply(), run(), with() - (1) (0) | 2020.07.22 |
댓글