You have several options:
for (i=0; i<OldVar.length;i++)
... if (OldVar.Substr(i,1) >="0" and OldVar.Substr(i,1)<="9")
... ... NewVar += OldVar.Substr(i,1);
(The ... replaces spaces, because this forum will remove all spaces, so this is just a little easier to read like this.
When this loop is done, NewVar will have ONLY digits. You can also check for "." if the value will be decimal.
Then you can use something like this:
int IntVar = Convert.ToInt32(NewVar);
There are, of course, other variations, but this is also good if you are dealing with phone numbers, and you want to strip out all the extra stuff, and other useful purposes. (A phone number like "(555) 123-4545" would become "5551234545", better for storage purposes in a Database, for instance.)
Good luck, and "happy programming".