Code example for SpannableStringBuilder

Methods: append, clear, formatNanpNumber, toString

0
        assertEquals("#130#*", PhoneNumberUtils.getStrippedReversed("*#031#"));
    } 
 
    @SmallTest 
    public void testNanpFormatting() { 
        SpannableStringBuilder number = new SpannableStringBuilder();
        number.append("8005551212");
        PhoneNumberUtils.formatNanpNumber(number);
        assertEquals("800-555-1212", number.toString());
 
        number.clear();
        number.append("800555121");
        PhoneNumberUtils.formatNanpNumber(number);
        assertEquals("800-555-121", number.toString());
 
        number.clear();
        number.append("555-1212");
        PhoneNumberUtils.formatNanpNumber(number);
        assertEquals("555-1212", number.toString());
 
        number.clear();
        number.append("800-55512");
        PhoneNumberUtils.formatNanpNumber(number);
        assertEquals("800-555-12", number.toString());
 
        number.clear();
        number.append("46645");
        PhoneNumberUtils.formatNanpNumber(number);
        assertEquals("46645", number.toString());
    } 
 
    @SmallTest 
    public void testConvertKeypadLettersToDigits() { 
        assertEquals("1-800-4664-411",