Verify possible fat fingered phone number

Does anyone have any suggestions for checking a phone number for a possible fat-finger? I have the OG phone number and a second number that could be either a possible fat fingered one or the person really changed their phone number. How could I compare them, and have code decide if the number truly changed or if was fat-fingered? Maybe break up the number in chunks (xxx-xxx-xxxx) and if 2 of 3 chunks match up then call it a fat-finger number? Thanks in advance!

What is an OG phone number?

You don't seem to have enough digits in your phone number for the general case, mine is 11 digits or 12 with the country code.

Street slang Colin, Urban Dictionary: OG

Thanks. I don't believe I have come across that before.

Simplest method would be to compare how many digits are not the same

const OG = "07983777234";
msg.payload = msg.payload.split("").filter((e, i) => OG[i] !== e).length;
return msg;

0 - number the same
1 - one digit different
2 - 2 digits different etc

you could take it further and compare the digits that are different, and find how far form the OG digit they are on the keyboard.

E1cid great thought! Thanks for sharing!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.