January 2018
Intermediate to advanced
434 pages
14h 1m
English
In this recipe, we will use the kotlin.stdlib library of Kotlin. Specifically, we will be working with the padStart and padEnd functions. Let's now follow the given steps to understand how to use these functions:
fun main(args: Array<String>) { val string="abcdef" val pad=string.padStart(10,'-') println(pad)}
This is the output:
----abcdef
val string="abcdef"val pad=string.padEnd(10,'-')println(pad)
Here's the output:
abcdef----
Read now
Unlock full access