Guest User

3.Censor Your Email Address - Exercises: Strings, Dictionari

a guest
Jun 6th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace CensorYourEMail
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string email = Console.ReadLine();
  14. string text = Console.ReadLine();
  15.  
  16. string[] partsOfEmail = email.Split('@');
  17. string username = partsOfEmail[0];
  18. string domain = partsOfEmail[1];
  19. string replacement = new string('*', username.Length) + "@" + domain;
  20.  
  21. text=text.Replace(email, replacement);
  22. Console.WriteLine(text);
  23. }
  24. }
  25. }
Add Comment
Please, Sign In to add comment