string_lettersdigits

Returns a copy of a given string with everything but its letters and digits removed.

Syntax:

GML Code Example

string_lettersdigits(str);


Argument Description
str The string to convert to letters and digits.


Returns: String


Description

This function will return a copy of a given string with everything but its letters and digits removed, which means it can be used to remove any unwanted characters (like "#" or "?") from, for example, a login name or a password.

Note: This function only detects the 26 letter english alphabet from A - Z.


Example:

GML Code Example

if string_length(password) > string_length(string_lettersdigits(password))
    {
    draw_text(32,32,"Invalid Password! Only Letters and numbers please!");
    }
 

The above code will check the length of a string against the length of the same string, but with all symbols removed. If they are not the same a message is drawn on the screen.


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