add Divider To Phone Number - Android android.telephony

Android examples for android.telephony:Phone Number

Description

add Divider To Phone Number

Demo Code


public class Main{

    public static String addDividerToPhoneNumber(String phoneNumber) {
        StringBuilder sb = new StringBuilder();
        sb.append(phoneNumber.substring(0, 3));
        sb.append("-");
        sb.append(phoneNumber.substring(3, 7));
        sb.append("-");
        sb.append(phoneNumber.substring(7));
        return sb.toString();
    }/*  ww  w.j  av a  2  s .c om*/

}

Related Tutorials