Similar%

Takes 2 parameters, pNum1, pNum2

Given two numbers, this function will return a blank (false) or a value between 1 and 100 depending on how closely the numbers match. Values of 100 are possible only when the numbers are the same length, and all characters match with the exception of it being case insensitive and also after removing accents from characters.

The comparison numbers are first reorganized by sorting the words within, such that the order of multiple words does not affect the score. Further, any extra whitespace is also ignored.

If one number is fully included in the other number, the return value will be at least 50. Therefore, the output of this function will typically only keep values of ==>> 50 and then be sorted from largest value to smallest.

Comparisons are made from left to right, and also right to left, up to the length of the shorter number. Differences in length are deducted from the score. Larger numbers are more forgiving than smaller numbers for mismatches in terms of values deducted.

This function is intended for simple things like full names. It does not attempt to find numbers within numbers other than the above described full match within.

Example:

[New] num1 = 123457
[New] num2 = 123456

[New] results = Similar% num1, num2

Html ("results: " & results) 'results is equal to 83