Guest User

Untitled

a guest
Apr 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. class Program
  2. {
  3. static void Main(string[] args)
  4. {
  5. string text = "My name is Adam";
  6. text = Regex.Replace(text, @"[^s]", "x");
  7. Console.WriteLine(text);
  8.  
  9. Console.ReadKey();
  10. }
  11. }
  12.  
  13. class Program
  14. {
  15. static void Main(string[] args)
  16. {
  17. string text = "My name is Adam";
  18.  
  19. // английские буквы
  20. text = Regex.Replace(text, @"[a-z]", "x");
  21. text = Regex.Replace(text, @"[A-Z]", "X");
  22.  
  23. // русские буквы
  24. text = Regex.Replace(text, @"[а-яё]", "x");
  25. text = Regex.Replace(text, @"[А-ЯЁ]", "X");
  26.  
  27. Console.WriteLine(text);
  28.  
  29. Console.ReadKey();
  30. }
  31. }
  32.  
  33. string text = "My name is Adam. Моё имя Адам.";
  34. text = Regex.Replace(text, @"p{Ll}", "x");
  35. text = Regex.Replace(text, @"p{Lu}", "X");
  36. Console.WriteLine(text);
Add Comment
Please, Sign In to add comment