Return to homepage

DOSATO

Copyright © 2024 Sebastiaan Heins

3.2 Strings

Functions

string to_string (val value)

Converts the given value to a string.
Exact same behaviour as a typecast to string.

array split (string value, string delimiter)

Splits a string into an array of strings, using the given delimiter.

string lower (string value)

Returns the given string in lowercase.

string upper (string value)

Returns the given string in uppercase.

long stringlength (string value)

Returns the length of the given string.

string substring (string value, long start, long end)

Returns a substring of the given string, starting at the given start index and ending at the given end index.

long stringindexof (string value, string search, long start = 0)

Returns the index of the first occurence of the given search string in the given string, starting at the given start index.

long stringlastindexof (string value, string search, long start = 0)

Returns the index of the last occurence of the given search string in the given string, starting at the given start index.

bool startswith (string value, string str, long start = 0)

Returns true if the given string starts with the given substring, starting at the given start index.

bool endswith (string value, string str, long start = 0)

Returns true if the given string ends with the given substring, starting at the given start index.

string replace (string value, string search, string replace, long start = 0)

Returns the given string with all occurences of the given search string replaced with the given replace string, starting at the given start index.

string trim (string value)

Returns the given string with all leading and trailing whitespace removed.

string stringreverse (string value)

Returns the given string in reverse.

bool stringcontains (string value, string search, long start = 0)

Returns true if the given string contains the given search string, starting at the given start index.

string stringremove (string value, long start, long end)

Returns the given string with the substring starting at the given start index and ending at the given end index removed.

string stringinsert (string value, string insert, long index)

Returns the given string with the given insert string inserted at the given index.

long stringtoint (string value)

Converts the given ascii string to an integer ("123" becomes 123).
If the string cannot be converted to an integer, 0 is returned.

double stringtodouble (string value)

Converts the given ascii string to a double ("123.45" becomes 123.45).
If the string cannot be converted to a double, 0 is returned.

long stringcount (string value, string search, long start = 0)

Returns the number of occurences of the given search string in the given string, starting at the given start index.

string join (array character_array, string delimiter)

Joins an array of strings into a single string, using the given delimiter.