GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Husseinhj/AndroidPattern: Format numbers using a string pattern with this simple number formatted like ##-####-##

BranchesTags
Open more actions menu

Latest commit

 

History

34 Commits
34 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
AndroidPatterns
AndroidPatterns
 
 
app
app
 
 
gradle/wrapper
gradle/wrapper
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
jitpack.yml
jitpack.yml
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

AndroidPattern

jitpack FOSSA Status

Format numbers using a string pattern with this simple number formatted like ##-####-##

Installation

To get a Git project into your build: Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

buildscript {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

Step 2. Add the dependency

implementation "com.github.Husseinhj:AndroidPattern:1.0.1"

Digit format

By default, numbers are defined by the # character and if you want to customize the format, use the digitPatterns property as shown in the following code:

AndroidPattern.digitPatterns = charArrayOf('#', '$', '*')

Sample

Mobile format:

val pattern = "98### ### ####"
val applied = "9121234567".applyPattern(pattern, exactPattern = true)

print(applied)

// 98912 123 4567

Postal code format:

val pattern = "#####-#####"
val applied = "4173412121".applyPattern(pattern)

print(applied)

// 41734-12121

Separator format:

val pattern = "###,###,###,###"
val applied = 123456789.applyPattern(pattern, exactPattern = true)

print(applied)

// 123,456,789

License

FOSSA Status

About

Format numbers using a string pattern with this simple number formatted like ##-####-##

Topics

formatterkotlin-androidstring-pattern-matching

Resources

Readme
Activity

Stars

2 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.