简体   繁体   English

拉联系电话号码问题

[英]pulling contact phone number issue

hi i have a class that pulls all the contacts. 嗨,我有一堂课,拉所有联系人。 in debugger i see phone number like this: phone String "\\U0000202a+111 11‑11‑11111\\U0000202c" 在调试器中,我看到这样的电话号码:phone String“ \\ U0000202a + 111 11‑11‑11111 \\ U0000202c”

when i print it, it shows 111 11-11-11111. 当我打印时,它显示111 11-11-11111。

because of this i cant do stringByReplacingOccurrencesOfString("-", withString: "", options: NSStringCompareOptions.RegularExpressionSearch, range: nil) 因此,我无法做到stringByReplacingOccurrencesOfString("-", withString: "", options: NSStringCompareOptions.RegularExpressionSearch, range: nil)

any idea why it gives me numbers like that , and is there a way to fix it ?? 知道为什么它会给我这样的数字,并且有办法解决吗?

ps = i use language that is right to left is it by any chance affects it ps =我使用的语言是从右到左,是否有可能会影响它

Yes, it's related to your right to left language. 是的,这与您从右到左的语言有关。 The codes are: 这些代码是:

0x202a LEFT-TO-RIGHT EMBEDDING 0x202a从左向右嵌入
...which tells the computer that the following string should go left to right. ...告诉计算机以下字符串应从左到右。

0x202c POP DIRECTIONAL FORMATTING 0x202c POP定向格式
...which tells the computer to go back to the previous text direction. ...告诉计算机返回上一个文本方向。

As how to get rid of them I don't know any specific method, but you should be able to just use normal string manipulation to eliminate them if they exist. 至于如何摆脱它们,我不知道任何特定的方法,但是您应该能够使用常规的字符串操作来消除它们(如果存在)。

EDIT: An example how you could trim them using stringByTrimmingCharactersInSet; 编辑:一个示例,您可以如何使用stringByTrimmingCharactersInSet修剪它们;

str = str.stringByTrimmingCharactersInSet(
           NSCharacterSet(charactersInString: "\u{202a}\u{202c}"))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM