string_digits

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

Syntax:

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:

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
Next: string_format
© Copyright YoYo Games Ltd. 2018 All Rights Reserved