Java tutorial
//package com.java2s; //License from project: Apache License import android.text.TextUtils; public class Main { public static String getPhoneNum(String formatedPhoneNum) { if (TextUtils.isEmpty(formatedPhoneNum)) { return ""; } else { if (formatedPhoneNum.startsWith("+86")) { formatedPhoneNum = formatedPhoneNum.substring(3, formatedPhoneNum.length()); } else if (formatedPhoneNum.startsWith("0086")) { formatedPhoneNum = formatedPhoneNum.substring(4, formatedPhoneNum.length()); } else if (formatedPhoneNum.startsWith("+0086")) { formatedPhoneNum = formatedPhoneNum.substring(5, formatedPhoneNum.length()); } return formatedPhoneNum.replaceAll(" ", "").replaceAll(" \t", ""); } } }