fork download
  1. using static System.Console;
  2. using System.Text;
  3.  
  4. public class Test {
  5. public static void Main() {
  6. WriteLine(RemoveNonDigits("M1245D454"));
  7. }
  8.  
  9. static string RemoveNonDigits(string text) {
  10. var newText = new StringBuilder(text.Length);
  11. foreach (var c in text) if (!char.IsDigit(c)) newText.Append(c);
  12. return newText.ToString();
  13. }
  14. }
  15.  
  16. //https://pt.stackoverflow.com/q/123453/101
Success #stdin #stdout 0.02s 22360KB
stdin
Standard input is empty
stdout
MD