fork download
  1. using static System.Console;
  2. using System.Text;
  3.  
  4. public class Program {
  5. public static void Main() {
  6. WriteLine("123.456.789/ 0001-99X".Strip());
  7. WriteLine("(19)9-98/754?283 A".Strip());
  8. }
  9. }
  10.  
  11. public static class StringExt {
  12. public static string Strip(this string str) {
  13. var sb = new StringBuilder(str.Length);
  14. foreach (var chr in str) if (char.IsDigit(chr)) sb.Append(chr);
  15. return sb.ToString();
  16. }
  17. }
  18.  
  19. //https://pt.stackoverflow.com/q/290618/101
Success #stdin #stdout 0.02s 15796KB
stdin
Standard input is empty
stdout
123456789000199
19998754283