Checks a given string and returns the character at a given position.


GML Code Example

string_char_at(str, index);

Argument Description
str The string to check.
index The position to get the character from.

Returns: String


You can use this function to return a specific character at a specific position within a string, with the index starting at 1 for the first character. If no character is found or the string is shorter than the value given to index, an empty string "" is returned.


GML Code Example

str1 = "Hello World";
 str2 = string_char_at(str1, 7);

This will set str2 to the seventh character ("H" counting as the 1st) in string str1, in this case "W".

Back: Strings

No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here