parseInt givin' me issues!

So I extract a string, by taking [string] input then .Remove(a,b)and remove part of the string, this leaves me with a string. Now I want to compare the left part of this string to an integer, eg. String: “Render 100” → String: “100” → ParseInt → Int: 100

But upon entering “Render 100a” this results in an error, 100a cannot be parsed to int. How do I avoid this, possibly in the part where I compare the original string, and checks if it has an index of “Render”.

ParseInt cannot understand the ‘a’ at the end of ‘100a.’ You’ll need to remove it. (Why is it there?)
//answer in comment below

Run it through your own ‘preprocess’ to create a string of only digits 0-9:

    string original_string;
    
    string number_string = "";
    
    for(int i = 0; i < original_string.Length; i++)
    {
      //continue this line from 0-9
      if(original_string <em>== '0' || original_string <em>== '1' || original_string *== '2'...)*</em></em>

{
//is a digit, add to string
//is a char, need to convert to string
number_string += original_string*.ToString();
_}
else //not a digit
{
//do nothing for now*

}_

}

//number_string should now be a string of only the numbers from the original_string
//There’s probably a more elegant way to do this :slight_smile:

– first result →

edit

Or even just: that which gives me this: