Search in sources :

Example 1 with Mask

use of com.redmadrobot.inputmask.helper.Mask in project caronae-android by caronae.

the class MyProfileFrag method getFormatedPlate.

// Use this function to get user car plate correctly formated
String getFormatedPlate(String plate) {
    final Mask mask = new Mask("[AAA]-[0000]");
    final String input = plate;
    final Mask.Result result = mask.apply(new CaretString(input, input.length()), // you may consider disabling autocompletion for your case
    true);
    final String output = result.getFormattedText().getString();
    return output;
}
Also used : Mask(com.redmadrobot.inputmask.helper.Mask) CaretString(com.redmadrobot.inputmask.model.CaretString) CaretString(com.redmadrobot.inputmask.model.CaretString)

Example 2 with Mask

use of com.redmadrobot.inputmask.helper.Mask in project caronae-android by caronae.

the class MyProfileFrag method getFormatedNumber.

// Use this function to get user phone number correctly formated
String getFormatedNumber(String phone) {
    final Mask mask = new Mask("({0}[00]) [00000]-[0000]");
    final String input = phone;
    final Mask.Result result = mask.apply(new CaretString(input, input.length()), // you may consider disabling autocompletion for your case
    true);
    final String output = result.getFormattedText().getString();
    return output;
}
Also used : Mask(com.redmadrobot.inputmask.helper.Mask) CaretString(com.redmadrobot.inputmask.model.CaretString) CaretString(com.redmadrobot.inputmask.model.CaretString)

Aggregations

Mask (com.redmadrobot.inputmask.helper.Mask)2 CaretString (com.redmadrobot.inputmask.model.CaretString)2