Skip to content
Justice Tech School

Kotlin Strings

Strings use $name or ${expression} templates. Common members: length, uppercase(), lowercase(), substring, replace, contains, trim, split and repeat. Triple quotes make raw multi line strings.

Example
val s = "Hello, Kotlin"
println("${s.length} ${s.uppercase()} ${s.substring(7)}")
println(s.replace("Kotlin", "World"))
println("a,b,c".split(","))
println("ab".repeat(3))

Exercise

Insert a variable.

"Hi name"

Quiz Test

Which symbol starts a string template?

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