Tsallaka zuwa abun ciki
Justice Tech School

String Operations

Common string functions: substring, split, replace, trim, startsWith, contains and format.

Example
val s = "  Hello, Kotlin  ".trim()
println(s.uppercase())
println(s.substring(7))
println(s.split(", "))
println(s.replace("l", "L"))
println("%.2f".format(3.14159))
println(s.reversed())

Exercise

Split text.

s.(",")

Quiz Test

What does trim remove?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.