GML Functions: String-Handling Functions

Below you find an overview of all constants, variables, and functions in GML related to handling characters and string. You can click on the name to get additional information.

Note that these string manipulation functions are based on the Delphi string manipulation functions. This means that strings start at position 1 and not 0.


 * chr(val) Returns a string containing the character with asci code val.
 * ord(str) Returns the ASCII code of the first character in str.
 * real(str) Turns str into a real number. str can contain a minus sign, a decimal dot and even an exponential part.
 * string(val) Turns the real value into a string using a standard format (no decimal places when it is an integer, and two decimal places otherwise).
 * string_format(val,tot,dec) Turns val into a string using your own format: tot indicates the total number of places and dec indicates the number of decimal places.
 * string_length(str) Returns the number of characters in the string.
 * string_pos(substr,str) Returns the position of substr in str (0=no occurrence).
 * string_copy(str,index,count) Returns a substring of str, starting at position index, and of length count.
 * string_char_at(str,index) Returns the character in str at position index.
 * string_delete(str,index,count) Returns a copy of str with the part removed that starts at position index and has length count.
 * string_insert(substr,str,index) Returns a copy of str with substr added at position index.
 * string_replace(str,substr,newstr) Returns a copy of str with the first occurrence of substr replaced by newstr.
 * string_replace_all(str,substr,newstr) Returns a copy of str with all occurrences of substr replaced by newstr.
 * string_count(substr,str) Returns the number of occurrences of substr in str.
 * string_lower(str) Returns a lowercase copy of str.
 * string_upper(str) Returns an uppercase copy of str.
 * string_repeat(str,count) Returns a string consisting of count copies of str.
 * string_letters(str) Returns a string that only contains the letters in str.
 * string_digits(str) Returns a string that only contains the digits in str.
 * string_lettersdigits(str) Returns a string that contains the letters and digits in str.

The following functions deal with the clipboard for storing text.


 * clipboard_has_text Returns whether there is any text on the clipboard.
 * clipboard_get_text Returns the current text on the clipboard.
 * clipboard_set_text(str) Sets the string str on the clipboard.