Replacing a string that contans an unknown number

I have this code snippet:

$string = [System.IO.File]::ReadAllText($TempPath).Replace("String","")
[System.IO.File]::WriteAllText($TempPath, $string)

The problem is that this string ends on an unknown number. Is there a quick way to determine this number and replace it?
E.G.: String = Example1 || Example2

I’d recommend using PowerShell operators instead of dotNet methods. The -replace operator supports regex patterns. The regex pattern for a digit is \d

Please always read the help topics completely including the examples to learn how to use it.