?? Brazilian Toolkit ??

Utils library for Brazilian specific businesses.

License API repo size

forks stars

Including in your project

Gradle

Add below codes to your root build.gradle file (not your module build.gradle file).

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

And add a dependency code to your module‘s build.gradle file.

dependencies {
    
}

Methods

Function Description Status
isCpf() Return true if CPF is valid
isCnpj() Return true if CNPJ is valid
getAllStates() Return list of all brazilian states ?
getAllCities() Return list of all cities based on state ?

Basic usage for CPF

"12345678911".isCpf()

Basic usage for CNPJ

"12345678911".isCnpj()

How to ignore characters

The characters . and - are replaced by String (allowing 127,455,799-41, for example), to modify, just use the charactersToIgnore function:

"127,455,799/41".isCpf(charactersToIgnore = listOf(',', '/'))

License

Copyright 2022 Geovani Amaral

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

GitHub

View Github