string_digits

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

Syntax:

GML Code Example

string_digits( str );


Argument Description
str The string to get the digits from.


Returns: String


Description

You can use this function to parse a given string and get any numbers from it. For example, say you have this text - "I am 81 years old". With this function you would get a return string of "81".


Example:

GML Code Example

var t_str;
 t_str = string_digits(input_str);
 age = real(t_str);
 

The above code will take the input string, strip it of all characters other than numbers and then set the variable "age" to hold the real number value of the return string.


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