string phoneNumber1 = 01234567899;
string PhoneNumber2 = +441234567899;
How do I compare last 10 digits only of these 2 strings in c#? These are 2 different formats of UK phone numbers for same number. I wan’t to compare them to find if they’re matching.
Thanks in advance
>Solution :
Approach with Reverse() and Take()
string number1 = "01234567899";
string number2 = "+441234567899";
bool result = number1.Reverse().Take(10).SequenceEqual(number2.Reverse().Take(10));