normalized number = "+<CC><HC><NUMBER>" non-normalized my be: <NUMBER> | <NationalPrefix><anyHC><NUMBER> | <InterntlPrefix><anyCC><anyHC><NUMBER>
so: Nr1 := Nr s/<IP>(.*)/\+$1/ #00 49 911 12345 -> + 49 911 12345 Nr2 = Nr1 s/<NP>/\+<CC>/ # 0 911 12345 -> + 49 911 12345 Nr3 = Nr2 s/[^\+](.*)/\+<CC><HC>$1/ # 12345 -> + 49 911 12345 step3 above isn't considered very practical for cellphones <IP>, <CC>, <NP>, and <HC> are user definable config-values apply normalization to both numbers prior to strcmp() *only* - no mangeling of numbers on storing, dialing, display to user nota bene: inbound call numbers are considered fully normalized (per GSM definition). If you like to cope with non-standards-conforming inbound numbers, you need a means to acquire CC' of the network currently in use, and use this CC' instead of CC for normalizing the inbound number. a good idea might be to cut all spaces as well, and also truncate any leading/trailing netcode sequences like *31#+49 911 12345 W;1**3 (truncate from left side and from right side all *short* sequences including any non-numeric+"+" delimeter, this is "*31#" (excluding the "+"!) for left, and "W;1**3" for right. Admittedly this part is tricky. Left side truncation is mandatory, right side a nice-to-have) cheers jOERG
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ devel mailing list devel@lists.openmoko.org https://lists.openmoko.org/mailman/listinfo/devel