The stripLeading() Function is used to remove any unwanted character from the left side of the String with Space by default.
fun main() {
var x = " Hello "
var y = x.stripLeading()
println(y+"World")
}
In the above code, we have declared a String ' Hello ' with leading and trailing spaces.
-Function1.png)
Then we have used the 'stripLeading()' function to remove the unwanted spaces from left side only.
-Function2.png)
So, the unwanted spaces are stripped out from the left side of the String.