W3cubDocs

/Kotlin

padStart

fun CharSequence.padStart(
    length: Int, 
    padChar: Char = ' '
): CharSequence

Returns a char sequence with content of this char sequence padded at the beginning to the specified length with the specified character or space.

Parameters

length - the desired string length.

padChar - the character to pad string with, if it has length less than the length specified. Space is used by default.

Returns Returns a string, of length at least length, consisting of string prepended with padChar as many times. as are necessary to reach that length.

fun String.padStart(length: Int, padChar: Char = ' '): String

Pads the string to the specified length at the beginning with the specified character or space.

Parameters

length - the desired string length.

padChar - the character to pad string with, if it has length less than the length specified. Space is used by default.

Returns Returns a string, of length at least length, consisting of string prepended with padChar as many times. as are necessary to reach that length.

© 2010–2017 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/pad-start.html