public interface CardFormatter
This file is open source and available under the MIT license. See the LICENSE file for more info.
Created by timon on 07/02/2018.
Modifier and Type | Method and Description |
---|---|
TextWatcher |
attachAsYouTypeExpiryDateFormatter(EditText editText)
Attach an as-you-type formatter to an
EditText to format input to an expiry date. |
TextWatcher |
attachAsYouTypeNumberFormatter(EditText editText)
Attach an as-you-type formatter to an
EditText to format input to a card number. |
java.lang.String |
formatExpiryDate(int expiryMonth,
int expiryYear)
Formats an expiry date.
|
java.lang.String |
formatNumber(java.lang.String number)
Formats a card number with spaces.
|
java.lang.String |
formatSecurityCode(java.lang.String securityCode)
Formats a security code.
|
java.lang.String |
maskNumber(java.lang.String number)
Mask a card number for displaying it in the user interface.
|
java.lang.String formatNumber(java.lang.String number)
number
- The card number to format.java.lang.String maskNumber(java.lang.String number)
number
- The card number.TextWatcher attachAsYouTypeNumberFormatter(EditText editText)
EditText
to format input to a card number.editText
- The EditText
to attach the formatter to.TextWatcher
.java.lang.String formatExpiryDate(int expiryMonth, int expiryYear)
expiryMonth
- The expiry month.expiryYear
- The expiry year.TextWatcher attachAsYouTypeExpiryDateFormatter(EditText editText)
EditText
to format input to an expiry date.editText
- The EditText
to attach the formatter to.TextWatcher
.java.lang.String formatSecurityCode(java.lang.String securityCode)
securityCode
- The security code to be formatted.