Mawu (Strings)
A string is a sequence of characters. In Duwa, Mawu (String) is a type that represents strings. It is used to represent text values. These strings are UTF-8 encoded.
Syntax
Examples usage
Escape Sequences
Duwa supports the following escape sequences in strings:
\"
- double quote\\
- backslash\n
- newline\r
- carriage return\t
- tab\u{}
- Unicode code point
Conversion to Mawu
To explicitly convert a value to a string, you can use the kuMawu
function.
Nambala
Numbers are converted to their string representation.
Tsimikizi
zoona
is converted to "zoona"
and bodza
is converted to "bodza"
.
Array
Arrays are converted to their string representation.
Classes
Classes are converted to their string representation.
Note: Convertion from other types to string is not supported yet. (If it works, it's a bug)
Methods
Arguments
Returns
This method checks if the string ends with the given string.
Arguments
Returns
This method finds the first occurrence of the given string in the string and returns it.
Arguments
Returns
This method finds all occurrences of the given string in the string and returns them.
Arguments
Returns
This method formats the string with the given arguments.
Returns
This method returns the length of the string.
Arguments
Returns
This method checks if the string matches the given regular expression.
Arguments
Returns
This method replaces all occurrences of the given string with the new string.
Arguments
Returns
This method splits the string by the given string and returns a list of strings.
Arguments
Returns
This method checks if the string starts with the given string.
Returns
This method converts the string to lowercase.
Returns
This method converts the string to a number.
Returns
This method converts the string to a string.
Returns
This method converts the string to uppercase.
Returns
This method removes whitespace from the beginning and end of the string.
Returns
This method removes whitespace from the end of the string.
Returns
This method removes whitespace from the beginning of the string.