Strings are useful for holding data that can be represented in text form. Strings may contain any valid Unicode character, including emojis.
Strings are created using either single or double quotes.
string1 := "A string value" string2 := 'This is also a string value'
Strings can be compared against each other using the
== operator. This will compare strings in a case-sensitive manner.
string1 := "a" string2 := "b" // false result := string1 == string2
Sometimes, your code will include strings which are very long. Rather than having lines that go on endlessly, or wrap at the whim of your editor, you may wish to specifically break the string into multiple lines in the source code without affecting the actual string contents.
You can achieve this using the
+ operator to append multiple strings together, like this:
longString := "This is a very long string which needs " + "to wrap across multiple lines because " + "otherwise the code will be unreadable."
Determines whether the calling string ends with the characters of string
Returns the length of the string.
Returns a list of strings populated by splitting the calling string at occurrences of the substring
Determines whether the calling string starts with the characters of string
Returns the string value converted to lowercase.
Returns the string value as a string.
Returns the string value converted to uppercase.
Trims whitespace from the beginning and end of the string.
Trims whitespace from the end of the string.
Trims whitespace from the beginning of the string.