All Projects β†’ TinkoffCreditSystems β†’ Decoro

TinkoffCreditSystems / Decoro

Licence: apache-2.0
Android library designed for automatic formatting of text input by custom rules

Programming Languages

java
68154 projects - #9 most used programming language

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
Grips
Simple-logic templates
Stars: ✭ 289 (-11.08%)
Mutual labels:  text
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
Text
πŸ“‘ Collaborative document editing using Markdown
Stars: ✭ 282 (-13.23%)
Mutual labels:  text
Blotter
A JavaScript API for drawing unconventional text effects on the web.
Stars: ✭ 2,833 (+771.69%)
Mutual labels:  text
Bonmot
Beautiful, easy attributed strings in Swift
Stars: ✭ 3,182 (+879.08%)
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
A
A graphical text editor
Stars: ✭ 280 (-13.85%)
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
Pangu.js
Paranoid text spacing in JavaScript
Stars: ✭ 3,265 (+904.62%)
Mutual labels:  text
Wasabi
🍣 A lightweight console printing and formatting toolkit
Stars: ✭ 272 (-16.31%)
Mutual labels:  formatting

Maven Central

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

sample static

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

sample static

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].