On Tue, Apr 13, 2010 at 6:45 PM, Rui Miguel Silva Seabra <[email protected]>wrote:

> Not in those words, but in order to do a comparison NOT ASSUMING
> maximum, minimum or fixed length, you have to compare numbers in an
> "aligned to right" matching.
>
> That is "select * from numbers where number like '%caller'" ? (I'm
> broadly speaking here).
>
>
Well, you are broadly wrong :P
Do you even know how we currently compare numbers?
We do:
select * from where number = '031234567'
And use a special correlation method that normalizes numbers with
phone-utils.
Normalization is as follows:
If there's a + on the left, do nothing, otherwise try to compare against the
international prefix (the 00 you used),
if exists, remove that, then compare country prefix, if exists, remove that,
then area code, if exists remove that.
After removing everything, add all the values back to make a +97231234567
number and then compare that.
This means that we can also handle special cases like different area codes,
different countries and essentially everything.

This algorithm was devised by DocScrutinizer which was a lead developer
hired by OpenMoko, which is an expert
in telephony (IIRC).

If you can provide a better algorithm which I can't provide a
counter-example for, please let me know.

>
-- 
Tom.
_______________________________________________
Shr-devel mailing list
[email protected]
http://lists.shr-project.org/mailman/listinfo/shr-devel

Reply via email to