Created
January 25, 2019 19:33
-
-
Save odahcam/74511f72f46d3c6fcb0e2395af73e835 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
string ObfuscarEmail(string input) | |
{ | |
int arroba = 0; | |
int firstDot = 0; | |
int secondDot = 0; | |
string firstPart = ""; | |
string secondPart = ""; | |
string thirdPart = ""; | |
arroba = input.IndexOf("@"); | |
firstPart = input.Substring(0, 2); | |
for(int i = 0; i < arroba - 2; i++) | |
{ | |
firstPart += "*"; | |
} | |
firstDot = input.Substring(arroba).IndexOf("."); | |
secondPart = input.Substring(arroba, 2); | |
for(int i = 0; i < firstDot - 2; i++) | |
{ | |
secondPart += "*"; | |
} | |
secondDot = input.Substring(arroba + firstDot).IndexOf("."); | |
thirdPart = input.Substring(arroba + firstDot); | |
for(int i = 0; i < secondDot - 2; i++) | |
{ | |
thirdPart += "*"; | |
} | |
return firstPart + secondPart + thirdPart; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment