Java tutorial
//package com.java2s; public class Main { public static String replaceWords(String phoneNumber) { String added_phoneNo = phoneNumber.replace(" ", "").replace("+", "").replace("-", "").replace("(", "") .replace(")", ""); // if(added_phoneNo.length() > 10) { // added_phoneNo = added_phoneNo.substring(added_phoneNo.length() - 10); // // } return added_phoneNo; } }