2011-04-18 62 views
0

我目前正在導出聯繫人內容提供程序中存儲的某些聯繫人的電話號碼,並且我想知道是否有某種方法可以爲電話號碼獲取「格式化」字符串。而不是xxx-xxx-xxxx => xxxxxxxxxx。爲了更好的數據庫一致性。格式化的字符串電話號碼android

這對於reg-ex來說很簡單,但是我想知道是否已經存在用於此目的的文件,如文檔。提及:

public static final String NUMBER - Since: API Level 5 
The phone number as the user **entered it**. 
Type: TEXT - Constant Value: "number" 

讓我想到一個標準格式存在的地方......? 在此先感謝!

+0

哇真的不知道有人嗎?我想我很樂意用正則表達式去... – olamotte 2011-04-19 21:27:08

回答

0

Reg-ex it!肯定沒有這樣的存在。

0

據我所知這樣的東西不存在。我認爲你必須自己寫。

0

如果你不想使用REG-EX代碼要比使用下面的代碼獲得此類型格式的數字

String[] temp=SelectedContactNo.split("-"); 
     String MoNo=""; 
     int len=temp.length; 
     for(int j=0;j<len;j++) 
     { 
      MoNo +=temp[j]; 
     } 

的現在,您將使用MoNo作爲格式的字符串。