Strings¶
Strings are sequences of characters.
Creating Strings¶
String Interpolation¶
String Operations¶
let text = "Hello World";
// Concatenation
let greeting = "Hello" + " " + "World";
// Length
print len(text); // 11
// Index
print text[0]; // H
print text[6]; // W
// Case conversion
print uppercase(text); // HELLO WORLD
print lowercase(text); // hello world
// Substring
print substr(text, 0, 5); // Hello
// Split
let words = split(text, " ");
print words; // ["Hello", "World"]
// Join
let joined = join(words, "-");
print joined; // Hello-World