Skip to content

Instantly share code, notes, and snippets.

@odahcam
Created January 25, 2019 19:33
Show Gist options
  • Save odahcam/74511f72f46d3c6fcb0e2395af73e835 to your computer and use it in GitHub Desktop.
Save odahcam/74511f72f46d3c6fcb0e2395af73e835 to your computer and use it in GitHub Desktop.
```
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