is_string

Returns whether the given argument is a string (as opposed to a real).

Syntax:

GML Code Example

is_string(n);


Argument Description
n The argument to check.


Returns: Boolean


Description

This function returns whether a given variable is a string number or not. In some cases you want to check and see if a variable in GameMaker: Studio holds a string and not a real and that's when you would use this function. It does not return the string but rather true or false, so a value of, for example, "fish" for n will return true, but a value of 200 for n will return false.


Example:

GML Code Example

if is_string(val)
    {
    name = "Player: " + val;
    }
 

The above code checks the variable "val" to see if it contains a string and if it does it adds it into another string which is then assigned to the variable "name".


Back: Strings
Next: string



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