fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. var car = "A test: んつきゃきゅきょ";
  9. Console.WriteLine(car);
  10. car = car.RegexReplace ( "ん", "n" )
  11. .RegexReplace ( "つ", "tsu" )
  12. .RegexReplace ( "きゃ", "kya" )
  13. .RegexReplace ( "きゅ", "kyu" )
  14. .RegexReplace ( "きょ", "kyo" );
  15.  
  16. Console.WriteLine(car);
  17. }
  18. }
  19.  
  20. public static class RegexStringExtension
  21. {
  22. public static String RegexReplace ( this String haystack, String regex, String replacement )
  23. {
  24. return new Regex ( regex ).Replace ( haystack, replacement );
  25. }
  26. }
  27.  
Success #stdin #stdout 0.03s 134720KB
stdin
Standard input is empty
stdout
A test: んつきゃきゅきょ
A test: ntsukyakyukyo