The FormatWatcher library provides a simple and easy-to-use way to apply predefined formatting to user input for Android EditText. The formatter is separator sensitive, meaning if a separator is entered manually, the format will not be applied again.
To install the library use Gradle:
Simply create a new instance of the FormatWatcher and set it as the TextWatcher for the EditText.
val formatter = FormatWatcher("###-##-####", '#')
The first argument passed to the FormatWatcher constructor is the format string to be applied to the text, the second argument is the character to be used as a placeholder in the format string.
You can customize the behavior of the FormatWatcher class by changing the format string, and the placeholder character to match your specific requirements.
If you find any bugs or have any suggestions for improvements, please open an issue or create a pull request on the GitHub repository
This library is released under the Apache 2.0 license. See the LICENSE file for more information.