strings

val greeting = "Hello World"

strings in Katton represent text values. you can modify, check, or split strings using the built in methods below

methods

methods you can call on any string:

val text = "  Hello Katton  "
text.toUpperCase() // returns "  HELLO KATTON  "
text.toLowerCase() // returns "  hello katton  "
text.trim() // returns "Hello Katton" (removes leading and trailing whitespace)

val data = "apple,banana,cherry"
data.length() // returns 19 (returns the number of characters)
data.contains("banana") // returns true
data.startsWith("apple") // returns true
data.endsWith("cherry") // returns true
data.replace("banana", "mango") // "apple,mango,cherry"
data.split(",") // ["apple", "banana", "cherry"] (returns a list)