fork(32) download
  1.  
  2. using System;
  3. using System.Text.RegularExpressions;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. string str = "Hello# , how are you?";
  10. string remove = Regex.Replace(str, @"[\W_]$", "");
  11. string result = Regex.Replace(remove, @"[\W_]+", "-");
  12. Console.WriteLine(result);
  13. Console.ReadLine();
  14. }
  15. }
Success #stdin #stdout 0.07s 34064KB
stdin
Standard input is empty
stdout
Hello-how-are-you