Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
fun main(args: Array<String>) {
val str = "May the Force be with you."
println(str)
val rawCrawl = """|long time ago,
|in a galaxy
|far far , away
|BUMM, BUUM , BUUMM"""".trimMargin()
println(rawCrawl)
// for (char in str) {
// println(char)
// }
val contentEquals = str.contentEquals("May the Force be with you.")
println(contentEquals)
val contains = str.contains("Force", true)
println(contains)
val uppercase = str.toUpperCase()
val lower = str.toLowerCase()
println(uppercase)
println(lower)
var num = 20
var stringNum = num.toString()
println(stringNum)
val subsequence = str.subSequence(4,13)
println(subsequence)
val name = "Luke Skywalker"
val color = "green"
val car = "Landspeeder"
val age = 27
println("$name has a $color lightsaber and drive a $car and is $age")
println("luke full name $name has ${name.length}")
}
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more