【发布时间】:2014-09-20 17:25:11
【问题描述】:
我从通讯录中获取了一个电话号码,并将它放在一个 NSString* 中:
ABMultiValueRef phoneProperty = ABRecordCopyValue(person,property);
NSString *phone = (__bridge_transfer NSString*)ABMultiValueCopyValueAtIndex(phoneProperty,identifier);
我只想将数字作为直字符串获取(意思是没有 (,)、+、- 等字符)。
当我执行上面的代码并检查它NSLog(@"phone is %@", phone); 我得到:phone is 1 (800) 800-8000
实际上,在 Xcode 控制台中,我看到在 '(' 之前和 ')' 之后有一个中心点符号,它没有正确复制到这篇文章中。
我的目标是将1 (800) 800-8000 变成这个18008008000。我该怎么做?
【问题讨论】:
-
我没有答案,但请记住,如果您打算支持本地化,有许多不同的格式。
标签: ios abaddressbook number-formatting phone-number