Re: easily search Address Book for phone numbers in various formats?
Re: easily search Address Book for phone numbers in various formats?
- Subject: Re: easily search Address Book for phone numbers in various formats?
- From: Torsten Curdt <email@hidden>
- Date: Mon, 11 Feb 2008 18:52:08 +0100
Just a newbie talking here ...but couldn't you override
- (NSComparisonResult)nameCompare:(ABPerson *)person
in ABPerson and do the magic matching in there?
I would try to strip out all non-digits and then check if the one
string is contained in the other.
cheers
--
Torsten
On 11.02.2008, at 18:42, Brad Peterson wrote:
Hi,
It occurs to me that you might also experiment with
NSString's hasSuffix: method, taking as a match the
first one where either string contains the other as a
suffix.
That way 808-555-1212 and +1 808-555-1212 would be a
match. You might get a few false matches, but probably
not too many to worry about.
HTH
--- Chris Blättermann
<email@hidden> wrote:
Hi Steve!
A quick-and-dirty solution would be parsing out all
the characters
which are not numbers and start the search with the
modified string.
Like +808-555-1212 would become 8085551212. Then you
loop through all
the contacts, read out the number and convert it the
same way.
Comparing these two strings with isEqualToString:.
Another way would be regular expressions, but I'm
not very good at it.
Kind regards,
Chris Blaettermann
Am 11.02.2008 um 12:06 schrieb Stephen Zyszkiewicz:
I'd like to use the Address Book framework to
search for phone
numbers in various formats. I would like to match
up a phone number
with a contact. The phone number may look like
+808-555-1212 or
8085551212 or +8085551212. Is there any way to
easily do this with
the AB framework or perhaps someone has figured
this out already?
Thank you!!
Steve
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator
comments to the list.
Contact the moderators at
cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
40blaettermann-software.de
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator
comments to the list.
Contact the moderators at
cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
______________________________________________________________________
______________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/
newsearch/category.php?category=shopping
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden