-
-
Notifications
You must be signed in to change notification settings - Fork 18
string_digits
CryoEagle edited this page Dec 26, 2018
·
4 revisions
Returns a copy of a given string with everything but its digits removed.
string_digits(str)
Argument | Description |
---|---|
string str |
The string to get the digits from. |
Returns: string
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".
string str1 = "We have 64 eggs";
string str2 = string_digits(str1);
int eggs = real(str2);
The above code will take the str1, strip it of all characters other than numbers and then set the variable "eggs" to hold the real number value of the return string.
Back to strings