[Resolved] Get a number from a random string?
Posted: Wed Feb 19, 2014 3:46 pm
Because of some reason Game-Editor do not support strtok with is newer then sscanf and as i remember it is a part of C89 standart liberally. Anyway.. lets say user input string in textbox like:
And a neutral text actor prints 16.
And the neutral actor prints 112.
Maybe something like:
- Code: Select all
I am 16 years old.
And a neutral text actor prints 16.
- Code: Select all
1 + 1 = 2.
And the neutral actor prints 112.
Maybe something like:
- Code: Select all
char * strton ( char str[512] )
{
char * str_output;
int n;
if (str[n] == '0' ||
str[n] == '1' ||
str[n] == '2' ||
str[n] == '3' ||
str[n] == '4' ||
str[n] == '5' ||
str[n] == '6' ||
str[n] == '7' ||
str[n] == '8' ||
str[n] == '9') { sprintf(str_output, "%c", str[n]); }
else { n++; }
return str_output;
}