🇧🇷
Brazilian Toolkit
🇧🇷
Utils library for Brazilian specific businesses.
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 {
implementation 'com.github.iamageo:brazilian-toolkit:1.0.1'
}
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
isCpf(cpf = "12345678911")
Basic usage for CNPJ
isCnpj(cnpj = "00000000000191")
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:
isCpf(cpf = "127,455,799/41", 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.