January 2018
Intermediate to advanced
434 pages
14h 1m
English
The padding functions are needed to expand the string to a certain length using the character provided with the function. So, if the length of the padded string is less than the string itself, it will just return the same string.
Another key thing to note is that by default, the padding character is a space character. This is the implementation of the padStart function:
public fun String.padStart(length: Int, padChar: Char = ' '): String = (this as CharSequence).padStart(length, padChar).toString()
As you can see, the default value for padChar is a space character, and it is called on a String object.
Read now
Unlock full access