String

Strings are a piece of UTF-8 text, and they are defined by the usage of double quotes (").

var hello = "World"

Escaping

You can use \ to escape the following characters

  • \n - Newline
  • \r - Return
  • \t - Tab
  • \\ - Backslash (\)
  • \" - Double qoute (`”)

Methods

String.Length() Number

Returns the amount of characters that the string consists of.

Example:

IO::Println("Hello".Length()) // 5
IO::Println("Hello, World".Length()) // 12
IO::Println("Hello, 🌍".Length()) // 8
IO::Println("😘".Length()) // 1

String.Bytes() Number

Returns how many bytes the string occupies.

Example:

IO::Println("Hello".Bytes()) // 5
IO::Println("Hello, World".Bytes()) // 12
IO::Println("Hello, 🌍".Bytes()) // 11
IO::Println("😘".Bytes()) // 4

String.At(Number) String

Returns the character at that position. The positions are 0-indexed.

This method takes Unicode-characters into consideration, so each “glyph” is one item.

Example:

IO::Println("abc".At(0)) // a
IO::Println("abc".At(1)) // b
IO::Println("I💖U".At(1)) // 💖