TinkoffCreditSystems / Decoro
Licence: apache-2.0
Android library designed for automatic formatting of text input by custom rules
Stars: β 325
Programming Languages
java
68154 projects - #9 most used programming language
Labels
Projects that are alternatives of or similar to Decoro
Prestyler
Elegant text formatting tool in Swift π₯
Stars: β 36 (-88.92%)
Mutual labels: text, formatting
Csconsoleformat
.NET C# library for advanced formatting of console output [Apache]
Stars: β 296 (-8.92%)
Mutual labels: text, formatting
AutoFormatInputWatcher
This repository contains input watcher for auto formatting digits in edit text
Stars: β 15 (-95.38%)
Mutual labels: text, formatting
Textwrap
An efficient and powerful Rust library for word wrapping text.
Stars: β 164 (-49.54%)
Mutual labels: text, formatting
humanize
A collection of utility functions, with built-in localization, for humanizing various types of data input
Stars: β 73 (-77.54%)
Mutual labels: text, formatting
Address Formatting
templates to format geographic addresses
Stars: β 253 (-22.15%)
Mutual labels: formatting
ngx-linkifyjs
Angular V8 wrapper for linkifyjs - library for finding links in plain text and converting them to HTML <a> tags via linkifyjs
Stars: β 40 (-87.69%)
Mutual labels: text
EnglishText.jl
Utilities for English-language quirks in Julia
Stars: β 12 (-96.31%)
Mutual labels: text
Bullet
π
Interactive prompts made simple. Build a prompt like stacking blocks.
Stars: β 3,257 (+902.15%)
Mutual labels: formatting
Sensitive
ζζθ―ζ₯ζΎ,ιͺθ―,θΏζ»€εζΏζ’ π€ FindAll, Validate, Filter and Replace words.
Stars: β 292 (-10.15%)
Mutual labels: text
Blotter
A JavaScript API for drawing unconventional text effects on the web.
Stars: β 2,833 (+771.69%)
Mutual labels: text
format.nvim
Neovim lua plugin to format the current buffer with external executables
Stars: β 189 (-41.85%)
Mutual labels: formatting
textlint-rule-terminology
Textlint rule to check correct terms spelling
Stars: β 32 (-90.15%)
Mutual labels: text
Texttailor.js
jQuery plugin, tailor made text to fill the height of the parent element or ellipse it if it doesn't fit
Stars: β 291 (-10.46%)
Mutual labels: text
Wasabi
π£ A lightweight console printing and formatting toolkit
Stars: β 272 (-16.31%)
Mutual labels: formatting
Decoro
Android library designed for automatic formatting of text input by custom rules.
Installation
Add to the build.gradle
of your app module:
dependencies {
compile 'ru.tinkoff.decoro:decoro:$latestVersion'
}
Usage
String
formatting
In examples below the content of the String text
will be formatted according to a mask.
Example 1. Using predefined mask
Mask mask = new MaskImpl(PredefinedSlots.RUS_PHONE_NUMBER, true);
mask.insertFront("9995554433");
System.out.println(mask.toString()); // +7 (999) 555-44-33
Using custom mask
Example 2:
Slot[] slots = new UnderscoreDigitSlotsParser().parseSlots("___ ___");
Mask mask = MaskImpl.createTerminated(slots); // 'terminated' mask
mask.insertFront("9995554433");
System.out.println(mask.toString()); // 999 555
Example 3:
Slot[] slots = new UnderscoreDigitSlotsParser().parseSlots("___ ___");
Mask mask = MaskImpl.createNonTeminated(slots); // 'non-terminated' mask
mask.insertFront("9995554433");
System.out.println(mask.toString()); // 999 5554433
Formatting "on the fly"
In examples below all the user's text input to EditText
will be formatted according to a mask.
Example 4. Using predefined mask
MaskImpl mask = MaskImpl.createTerminated(PredefinedSlots.CARD_NUMBER_USUAL);
FormatWatcher watcher = new MaskFormatWatcher(mask);
watcher.installOn(editText); // install on any TextView
Masks available out of the box:
PredefinedSlots.SINGLE_SLOT // Any character
PredefinedSlots.RUS_PHONE_NUMBER // Russian phone number formatted as +7 (___) ___-__-__ (digits only)
PredefinedSlots.RUS_PASSPORT // Series and number of russian passport formatted as ____ ______ (digits only)
PredefinedSlots.CARD_NUMBER_STANDARD // Credit card number formatted as ____ ____ ____ ____ (digits only)
PredefinedSlots.CARD_NUMBER_STANDARD_MASKABLE // Credit card number formatted as ____ ____ ____ ____ (digits and chars 'X', 'x', '*')
PredefinedSlots.CARD_NUMBER_MAESTRO // Credit card number formatted as ________ ____ (digits only)
PredefinedSlots.CARD_NUMBER_MAESTRO_MASKABLE // Credit card number formatted as ________ ____ (digits and chars 'X', 'x', '*')
Example 5. Using custom mask
Slot[] slots = new UnderscoreDigitSlotsParser().parseSlots("___ ___ ___");
FormatWatcher formatWatcher = new MaskFormatWatcher(MaskImpl.createTerminated(slots));
formatWatcher.installOn(editText); // install on any TextView
Migration
In version 1.1.0 class FormatWatcherImpl
was renamed to DescriptorFormatWatcher
.
Also this version introduced MaskFormatWatcher
that offers more clean API than DescriptorFormatWatcher
.
References
More examples and details can be found in our wiki (in Russian yet).
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].