Last active
November 19, 2024 20:45
-
-
Save martyncoup/0da47be96a80c81d02f0537faaffd709 to your computer and use it in GitHub Desktop.
Validate plus address against a root address
This file contains hidden or 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
using System; | |
public static class Program | |
{ | |
public static bool IsPlusAddressUsed(string plus, string root) | |
{ | |
var parts = plus.Split('@'); | |
var formattedEmail = $"{parts[0].Split('+')[0]}@{parts[1]}"; | |
return formattedEmail == root; | |
} | |
public static void Main() | |
{ | |
var email = "[email protected]"; | |
var plusAddress = "[email protected]"; | |
Console.WriteLine(IsPlusAddressUsed(plusAddress, email)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment