Wikipedia: String
A string is an immutable sequence of bytes. In Tengo, strings are UTF-8 encoded by default.
fmt := import("fmt")
text := import("text")
s := "Hello, Tengo!"
fmt.println("len: ", len(s))
fmt.println("slice: ", s[7:12])
fmt.println("upper: ", text.to_upper(s))
fmt.println("lower: ", text.to_lower(s))
fmt.println("contains 'Tengo': ", text.contains(s, "Tengo"))
fmt.println("replace: ", text.replace(s, "Tengo", "World", -1))
parts := text.split("a,b,c", ",")
fmt.println("split: ", parts)
fmt.println("join: ", text.join(["x", "y", "z"], "-"))
try it
len: 13 slice: Tengo upper: HELLO, TENGO! lower: hello, tengo! contains 'Tengo': true replace: Hello, World! split: ["a", "b", "c"] join: x-y-z